From: "DuckE" <nospam_steved94@home.com>
Subject: Re: Fairly simple question about using time in Ada
Date: Sat, 29 Sep 2001 12:44:09 GMT
Date: 2001-09-29T12:44:09+00:00 [thread overview]
Message-ID: <tmjt7.52614$QK.35544420@news1.sttln1.wa.home.com> (raw)
In-Reply-To: 3bb5234f$0$9274$afc38c87@news.optusnet.com.au
Here is what I usually do:
WITH Ada.Text_Io;
WITH Ada.Float_Text_Io;
PROCEDURE Elapsed_Time_Demo IS
PACKAGE Text_Io RENAMES Ada.Text_Io;
PACKAGE Float_Text_Io RENAMES Ada.Float_Text_Io;
PACKAGE Real_Time RENAMES Ada.Real_Time;
USE TYPE Real_Time.Time;
start_time : Real_Time.Time;
end_Time : Real_Time.Time;
elapsed_time : Real_Time.Time_Span;
BEGIN
start_time := Real_Time.Clock;
FOR ii IN 1 .. 1_000_000 LOOP -- Something that needs timing
NULL; --
END LOOP; --
end_time := Real_Time.Clock;
elapsed_time := end_time - start_time;
Text_Io.Put( "Elapsed time is: " );
Float_Text_Io.Put( Float( Real_Time.To_Duration( elapsed_Time ) ), 3, 2,
0 );
END Elapsed_Time_Demo;
"Chris Vinall" <cjvinall@dingoblue.net.au> wrote in message
news:3bb5234f$0$9274$afc38c87@news.optusnet.com.au...
> I'm writing a program in which I need to be able to timestamp events and
> then later check how much real time has elapsed since that event occurred.
> It is essential that this timing operate to tenths of a second and
> hundredths of a second would be a lot better.
>
> How do I go about doing this in Ada? My textbook mentioned something about
> Duration but was less than helpful.
>
> Thanks for any help
>
> Chris
>
>
next prev parent reply other threads:[~2001-09-29 12:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-29 1:26 Fairly simple question about using time in Ada Chris Vinall
2001-09-29 2:33 ` James Rogers
2001-10-02 5:56 ` tmoran
2001-09-29 12:44 ` DuckE [this message]
2001-10-03 10:27 ` Petter Fryklund
2001-10-04 10:03 ` Alfred Hilscher
2001-10-04 17:56 ` R. Tim Coslet
2001-10-04 19:44 ` tmoran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox