TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jesse Farmer <[log in to unmask]>
Reply To:
Jesse Farmer <[log in to unmask]>
Date:
Sun, 5 Nov 2000 00:14:40 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
At 10:17 PM 11/4/00 -0600, jrcarter wrote:
"Without addressing the ways that Windows can be made to provide
microsecond accuracy, which I have seen discussed, perhaps here or on
comp.lang.ada, I must say that I have been unable to get the program you
posted to output numbers within 20% of the numbers you posted. I also
have no idea why you have the 30-second delay at the end of the program,
but it would make the execution time of the program exceed 90 seconds."


My apologies.  I accidentially posted the code that I used to test the
accuracy of the delay statement itself, which, as your results showed, is
fairly accurate.
The code should have read:

*********Begin Code*****************

   with Ada.Real_Time; use Ada.Real_Time;
    with Ada.Text_Io;
--      with Ada.Standard;

    procedure TestTime is

       -- ----------------------------------------------------------
       --  GET THE STARTING TIME, LOOP, GET THE END TIME, SUBSTRACT
       -- ----------------------------------------------------------

       Time_Start      : Ada.Real_Time.Time;
       Time_End        : Ada.Real_Time.Time;
       Time_Difference : Ada.Real_Time.Time_Span;
       Time_Duration   : Standard.Duration;

    begin

       Time_Start := Ada.Real_Time.Clock;
       for I in 1..17400 loop
          delay 0.003448275862;
       end loop;
       Time_End := Ada.Real_Time.Clock;
       Time_Difference := Time_End - Time_Start;

        Time_Duration := Ada.Real_Time.To_Duration(Time_Difference);

        Ada.Text_Io.Put("Time Difference: ");
       Ada.Text_Io.Put(Duration'Image(Time_Duration));

       delay 30.0;

    end TestTime;

***********End Code************

ATOM RSS1 RSS2