From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ffe8077058c9c24b X-Google-Attributes: gid103376,public From: Keith Thompson Subject: Re: Conversion to UNIX time Date: 2000/07/20 Message-ID: #1/1 X-Deja-AN: 648566092 Sender: kst@king.cts.com References: <20000719014423.05992.00000168@ng-fz1.aol.com> X-Trace: thoth.cts.com 964091452 19476 205.163.0.22 (20 Jul 2000 11:10:52 GMT) Organization: CTSnet Internet Services Newsgroups: comp.lang.ada X-Complaints-To: abuse@cts.com Date: 2000-07-20T00:00:00+00:00 List-Id: 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 San Diego Supercomputer Center <*> Welcome to the last year of the 20th century.