How to generate Unix time from dates?

John T. Nelson jtn at ADS.COM
Fri Oct 26 06:31:34 AEST 1990



For a project I'm working on I'd like to generate an unsigned long
which contains the time of day on Unix systems.  This amounts to usec
in the Unix time.h time_val struct I think.

Is there an algorithm for doing this?  For example I would like to
generate the time for Jan 1 1970 or Jan 1 1904.  Does this algoirthm
also take into acount leap years and LEAP SECONDS?  Are there other
wierdnesses to worry about?

By the way, I know the epoch began in 1970 but there are reasons I
would also like to generate time from 1904 and still state it in Unix
time format in usec's.

Please respond by mail since are news capability is down.  Thanks.



--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ORGANIZATION:  Advanced Decision Systems   GEOGRAPHIC: Arlington, VA
UUCP:          kzin!speaker at mimsy.umd.edu  INTERNET:   jtn at potomac.ads.com



More information about the Comp.unix.questions mailing list