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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,75c440b4b7ed5f91 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Real Time IO routines Reply-To: anon@anon.org (anon) References: <1193410739.367181.96050@50g2000hsm.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Sat, 27 Oct 2007 20:15:15 GMT NNTP-Posting-Host: 12.64.108.169 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1193516115 12.64.108.169 (Sat, 27 Oct 2007 20:15:15 GMT) NNTP-Posting-Date: Sat, 27 Oct 2007 20:15:15 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:2608 Date: 2007-10-27T20:15:15+00:00 List-Id: Ada Purist never and I mean NEVER uses IMAGE attribute, in the body of a program. They create a package or sub-package that performs the IO functions with the use of the IMAGE attribute. IMAGE attribute is the last thing a programmer should use. to print a value. It is normally use for DEBUGGING ONLY! A programmer should always create a routine or better yet a package that uses an algorithm to prints the value without the use of attributes. Mostly programs that are created by newbees use IMAGE attribute. And as for my code! It answer the person question without adding extra code that might confuse him. Plus, the "Ada.Real_Time" package uses: type Time is new Duration; which is in private section. So I know what to convert the value to. In , "Dmitry A. Kazakov" writes: >On Sat, 27 Oct 2007 08:56:42 GMT, anon wrote: > >> function To_Duration is new Ada.Unchecked_Conversion > ( Time, Duration ) ; > >That is a bad idea. You don't know what is the internal representation of >Time. The intended effect can be achieved legally: > >with Ada.Real_Time; use Ada.Real_Time; >with Ada.Text_IO; use Ada.Text_IO; > >procedure Test is > function Image (T : Time) return String is > Seconds : Seconds_Count; > Fraction : Time_Span; > begin > Split (T, Seconds, Fraction); > declare > After : constant String := > Duration'Image (To_Duration (Fraction)); > begin > return Seconds_Count'Image (Seconds) & After (2..After'Last); > end; > end Image; >begin > delay 0.5; > Put_Line (Image (Clock) & "s since the epoch"); > delay 0.5; > Put_Line (Image (Clock) & "s since the epoch"); >end Test; > >-------------------- >However it is quite useless to output absolute time values involving an >unknown epoch. Unfortunately there is no portable way I know of to convert >Real_Time.Time to UTC. > >-- >Regards, >Dmitry A. Kazakov >http://www.dmitry-kazakov.de