North American Network Operators Group

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical

Re: Unix Timestamp

  • From: Steven M. Bellovin
  • Date: Mon Oct 22 15:11:36 2001

In message <[email protected]>, Robert E. Seastrom writes:
>
>
>Brandon Handeland <[email protected]> writes:
>
>> Does anyone have a formula to convert a unix time stamp into the
>> current time?  I know it is January 1st, 1970, in UTC format.  Just
>> need some example code.
>> 
>> I'm trying to export some data from a HP/UX box into a MSSQL database and 
>> need to use the timestamp feature of MSSQL.
>
>The best code I've seen for this (and which knows about most variants
>of the timestamp seen in the wild) was written by Steve Bellovin et
>al, and can be found in the inn distribution in lib/parsedate.y

Thanks -- but I think that my code performs the inverse function.  That 
is, it converts lots of different time formats *into* Unix time.  Also, 
so much of the code was rewritten by others in the mid-1990's that I'm 
not sure it's fair to call it mine any more.  (My code was written in 
1979, when 'int' was a 16-bit datatype, 'long' didn't exist, and the 
yacc stack was composed of 16-bit values only -- all of which are why 
it needed to be rewritten...  As a fringe benefit, my original code 
not only had y2k issues, it refused to convert any dates after 2000.)

		--Steve Bellovin, http://www.research.att.com/~smb
		Full text of "Firewalls" book now at http://www.wilyhacker.com