Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Mar 2007 17:04:10 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-chat@FreeBSD.ORG, deeptech71@gmail.com
Subject:   Re: 64bit timestamp
Message-ID:  <200703241604.l2OG4AU7084283@lurza.secnetix.de>
In-Reply-To: <46042B3A.7070100@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
deeptech71@gmail.com wrote:
 > UNIX Timestamp:
 >    32 bits, starts from year 1970, ticks every second
 >    capable of representing the time from 1970 to 2106

No, the UNIX time_t is a signed value, so it ranges from
1901 to 2038 when it's a 32bit int (such as on FreeBSD;
Solaris has a 64bit time_t, for example):

$ date -r $(( - 2 ** 31 ))
Fri Dec 13 21:45:52 CET 1901
$ date -r $(( 2 ** 31 - 1 ))
Tue Jan 19 04:14:07 CET 2038

(I'm using a privately patched version of /bin/sh which
knows the "**" operator, among other things.)

 >    'til then, computers will change
 >    sufficient for file timestamps, comparing file times

FreeBSD's UFS2 already uses 96bit timestamps, where 64 bits
are used for seconds and 32 bits are used for nanoseconds.
Is that sufficient for you?

See <ufs/ufs/dinode.h> for the actual definitions:

typedef int64_t ufs_time_t;
[...]
struct ufs2_dinode {
        [...]
        ufs_time_t      di_atime;       /*  32: Last access time. */
        ufs_time_t      di_mtime;       /*  40: Last modified time. */
        ufs_time_t      di_ctime;       /*  48: Last inode change time. */
        ufs_time_t      di_birthtime;   /*  56: Inode creation time. */
        int32_t         di_mtimensec;   /*  64: Last modified time. */
        int32_t         di_atimensec;   /*  68: Last access time. */
        int32_t         di_ctimensec;   /*  72: Last inode change time. */
        int32_t         di_birthnsec;   /*  76: Inode creation time. */
        [...]
}

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"I have stopped reading Stephen King novels.
Now I just read C code instead."
        -- Richard A. O'Keefe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703241604.l2OG4AU7084283>