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: "Robert I. Eachus" Subject: Re: Conversion to UNIX time Date: 2000/07/28 Message-ID: <3981054F.F4E6CB50@earthlink.net>#1/1 X-Deja-AN: 651676678 Content-Transfer-Encoding: 7bit References: <20000719014423.05992.00000168@ng-fz1.aol.com> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 964756801 63.24.60.185 (Thu, 27 Jul 2000 21:00:01 PDT) Organization: The MITRE Corporation MIME-Version: 1.0 NNTP-Posting-Date: Thu, 27 Jul 2000 21:00:01 PDT Newsgroups: comp.lang.ada Date: 2000-07-28T00:00:00+00:00 List-Id: 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);