Re: Time Function

From: Dave Hudson <dave_at_nospam.org>
Date: Thu Jun 16 1994 - 02:28:40 PDT

Hi All,

>
> [Tan Pong Heng <tponghen@Trantor.DSO.gov.SG> writes:]
>
> >... So my question is: does any body know what is the magic value of
> >the no of sec from 1970 to 1990?
>
> Dave Hudson added this to <time.h> for the next release:
>
> /*
> * The difference between VSTa time and UNIX time is 20 years. VSTa starts
> * ticking from 1990 not 1970. This constant handles the conversion. Note
> * that as well as 5 leap years there were 15 leap seconds as well :-) If
> * you're interested in the leap seconds, RFC1305 (NTP) provides more detail
> */
> #define VSTA_UNIX_TDIFF (((20*365)+5)*24*60*60)+15)

Just to keep this straight, I've since added timezone support to the libc
code. This defaults to POSIX support, and the leap seconds are ignored.
This bit of code (latest I've sent to Andy) now looks like:

/*
 * The difference between VSTa time and UNIX time is 20 years. VSTa starts
 * ticking from 1990 not 1970. Additionally, MS-DOS started ticking in 1980
 * so we have a constant for the difference there as well. Note that as
 * well as leap years there were also leap seconds as well :-) If you're
 * interested in the leap seconds, RFC1305 (NTP) provides more detail (we
 * ignore them here though)
 */
#define VSTA_UNIX_TDIFF (631152000)
#define VSTA_DOS_TDIFF (315619200)
#define DOS_UNIX_TDIFF (VSTA_UNIX_TDIFF - VSTA_DOS_TDIFF)

One of the other points that comes out of the mods to the time code are
that negative time values are supported (time_t is a signed long) so we can
now handle timestamps from before 1990. The only time that can't be
reproduced is -1 (23:59:59 on 31st December 1989) as this is an error return
value from mktime(). I've sent some diffs to the dos server to allow -ve
timestamps (the -1 isn't even a problem as dos fs is only accurate to 2
seconds).

                Regards,
                Dave
Received on Thu Jun 16 01:44:06 1994

This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 21:04:28 PDT