comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Conversion to UNIX time
Date: 2000/07/20
Date: 2000-07-20T00:00:00+00:00	[thread overview]
Message-ID: <yeclmyxhxab.fsf@king.cts.com> (raw)
In-Reply-To: 20000719014423.05992.00000168@ng-fz1.aol.com

tennisbb@aol.com (Tennisbb) writes:
> My project has decided to name recording files (of which there will
> probably be MANY) by a number of fields, the first two of which will
> be Start Time and End Time in 8-digit Hex UNIX time.  Despite our
> wide use of re-use, I can't locate any routines to convert Calendar
> Time to an 8-digit Hex string, and wondered if anyone has any
> procedures they'd be willing to share...  The reason for the Hex
> times is to reduce the search time later.

You might try interfacing to the standard C function mktime() (or
using an existing binding if you can find one).  There are a few
things to watch out for: tm_year is year - 1900, and tm_mon is in the
range 0..11, not 1..12.  If you're on a Unix system, see the mktime(3)
man page for details.

Note that the C standard does not guarantee that time_t measures
seconds since 1970-01-01 00:00:00 UTC, though I think POSIX does.

If you're interested in the current time rather than necessarily
converting from an existing Calendar.Time value, you might consider
interfacing directly to C's time() function.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Welcome to the last year of the 20th century.




  parent reply	other threads:[~2000-07-20  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-19  0:00 Conversion to UNIX time Tennisbb
2000-07-19  0:00 ` Stephen Leake
2000-07-20  0:00   ` tmoran
2000-07-20  0:00 ` Keith Thompson [this message]
2000-07-28  0:00 ` Robert I. Eachus
2000-07-27  0:00   ` Keith Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox