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/27 Message-ID: #1/1 X-Deja-AN: 651702788 Sender: kst@king.cts.com References: <20000719014423.05992.00000168@ng-fz1.aol.com> <3981054F.F4E6CB50@earthlink.net> X-Trace: thoth.cts.com 964764314 71004 205.163.0.22 (28 Jul 2000 06:05:14 GMT) Organization: CTSnet Internet Services Newsgroups: comp.lang.ada X-Complaints-To: abuse@cts.com Date: 2000-07-27T00:00:00+00:00 List-Id: "Robert I. Eachus" 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 San Diego Supercomputer Center <*> Welcome to the last year of the 20th century.