[43670] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

Re: Unix Timestamp

daemon@ATHENA.MIT.EDU (Steven M. Bellovin)
Mon Oct 22 15:11:29 2001

From: "Steven M. Bellovin" <smb@research.att.com>
To: rs@seastrom.com (Robert E. Seastrom)
Cc: Brandon Handeland <Brandon@wyoming.com>, nanog@merit.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 22 Oct 2001 15:08:51 -0400
Message-Id: <20011022190851.A1BC17B55@berkshire.research.att.com>
Errors-To: owner-nanog-outgoing@merit.edu


In message <87elnvtsdd.fsf@valhalla.seastrom.com>, Robert E. Seastrom writes:
>
>
>Brandon Handeland <Brandon@wyoming.com> 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



home help back first fref pref prev next nref lref last post