comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: Real Time IO routines
Date: Sat, 27 Oct 2007 20:15:15 GMT
Date: 2007-10-27T20:15:15+00:00	[thread overview]
Message-ID: <n%MUi.28149$kj1.3077@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: ddn82trtef34$.n1ulcxn4se96.dlg@40tude.net

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 <ddn82trtef34$.n1ulcxn4se96.dlg@40tude.net>, "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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




  reply	other threads:[~2007-10-27 20:15 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 14:58 Real Time IO routines andrew
2007-10-26 16:43 ` Anh Vo
2007-10-26 16:53   ` andrew
2007-10-26 17:04     ` Anh Vo
2007-10-26 17:21       ` andrew
2007-10-26 18:31         ` Anh Vo
2007-10-26 18:36         ` Ludovic Brenta
2007-10-26 20:00           ` andrew
2007-10-26 20:29             ` Ludovic Brenta
2007-10-26 20:46               ` Dmitry A. Kazakov
2007-10-26 20:33             ` Dmitry A. Kazakov
2007-10-26 21:14               ` andrew
2007-10-26 21:54                 ` Anh Vo
2007-10-26 22:34                 ` Adam Beneschan
2007-10-27  1:58                 ` tmoran
2007-10-27 12:40                 ` John McCormick
2007-10-27 20:12                   ` andrew
2007-10-26 17:12 ` Ed Falis
2007-10-27  8:56 ` anon
2007-10-27 10:18   ` Dmitry A. Kazakov
2007-10-27 20:15     ` anon [this message]
2007-10-27 20:49       ` Dmitry A. Kazakov
2007-10-27 21:51       ` Simon Wright
2007-10-28 11:35         ` Ludovic Brenta
2007-10-30 14:37           ` Simon Clubley
2007-10-30 13:47             ` Ludovic Brenta
2007-10-30 14:46             ` Jean-Pierre Rosen
2007-10-31 14:38               ` Ada coding standards, was: " Simon Clubley
2007-10-31 18:02                 ` anon
2007-10-31 19:23                   ` Georg Bauhaus
2007-10-31 20:40                   ` John W. Kennedy
2007-11-01 11:27                   ` Stephen Leake
2007-11-01 20:38                     ` anon
2007-10-29 19:28         ` Real Time IO routines -- answering Simon Wright part 1 anon
2007-10-29 21:24           ` Georg Bauhaus
2007-10-29 21:31             ` Georg Bauhaus
2007-10-29 22:01             ` Dmitry A. Kazakov
2007-10-29 22:38           ` Keith Thompson
2007-10-30  0:58             ` tmoran
2007-10-30 16:35         ` Real Time IO routines answering Simon Wright part 2 anon
2007-10-30 21:50           ` Simon Wright
2007-10-31 15:35           ` Adam Beneschan
2007-10-31 20:08             ` anon
2007-10-31 21:08               ` Georg Bauhaus
2007-10-31 21:42               ` Markus E L
2007-11-01  1:00               ` Adam Beneschan
2007-10-28  1:15       ` Real Time IO routines Jeffrey Creem
2007-10-29 16:18       ` Adam Beneschan
2007-10-29 16:40         ` Robert A Duff
2007-10-29 17:26           ` Adam Beneschan
2007-10-29 22:34             ` Keith Thompson
2007-10-29 17:25         ` Jean-Pierre Rosen
2007-11-15  4:27         ` Randy Brukardt
2007-11-15  4:27         ` Randy Brukardt
2007-10-29 18:53       ` andrew
2007-10-29 22:35         ` 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