comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@earthlink.net>
Subject: Re: Conversion to UNIX time
Date: 2000/07/28
Date: 2000-07-28T00:00:00+00:00	[thread overview]
Message-ID: <3981054F.F4E6CB50@earthlink.net> (raw)
In-Reply-To: 20000719014423.05992.00000168@ng-fz1.aol.com

Tennisbb wrote:
> 
> 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.

    I could write all of this in a few lines, but you had better do it,
because the declarations
are going to reflect information you did not give.

    Having said that, Use Unchecked_Conversion to convert the time
representation to an integer or better a modular type.  Next instantiate
Ada.Text_IO.Integer_IO or Modular_IO for that type.  Now call Put (to
string) with Base = 16.  Edit the return string to remove the leading "
16#" and trailing "#".  Sounds very complex, but you can do the call to
Unchecked_Conversion nested, then subscript the returned value:

   Temp: String(1..13);
 begin
   Mod_IO.Put(Temp, My_UC(Start_Time), 16);
   FileName(X..X+7) := Temp(5..12);




  parent reply	other threads:[~2000-07-28  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
2000-07-28  0:00 ` Robert I. Eachus [this message]
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