comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Conversion to UNIX time
Date: 2000/07/27
Date: 2000-07-27T00:00:00+00:00	[thread overview]
Message-ID: <yec66pqzt5x.fsf@king.cts.com> (raw)
In-Reply-To: 3981054F.F4E6CB50@earthlink.net

"Robert I. Eachus" <rieachus@earthlink.net> writes:
[...]
>     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);

Why use Unchecked_Conversion?  If Start_Time is of an integer type,
wouldn't an ordinary type conversion make more sense?

Start_Time is probably a time_t, which on many systems is a 32-bit
signed integer.  (But not all; I work on systems where time_t is
64 bits -- as it's likely to be on all systems by 2038.)

-- 
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.




      reply	other threads:[~2000-07-27  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
2000-07-27  0:00   ` Keith Thompson [this message]
replies disabled

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