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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51aec3e725649fde X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-29 05:44:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!feed.textport.net!out.nntp.be!propagator-SanJose!news-in-sanjose!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttln1.wa.home.com.POSTED!not-for-mail From: "DuckE" Newsgroups: comp.lang.ada References: <3bb5234f$0$9274$afc38c87@news.optusnet.com.au> Subject: Re: Fairly simple question about using time in Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Sat, 29 Sep 2001 12:44:09 GMT NNTP-Posting-Host: 24.248.45.203 X-Complaints-To: abuse@home.net X-Trace: news1.sttln1.wa.home.com 1001767449 24.248.45.203 (Sat, 29 Sep 2001 05:44:09 PDT) NNTP-Posting-Date: Sat, 29 Sep 2001 05:44:09 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:13511 Date: 2001-09-29T12:44:09+00:00 List-Id: 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" 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 > >