comp.lang.ada
 help / color / mirror / Atom feed
* Problems with a TIMER
@ 2003-01-28 10:40 NERO
  2003-01-28 18:36 ` Stephen Leake
  2003-01-28 18:42 ` tmoran
  0 siblings, 2 replies; 3+ messages in thread
From: NERO @ 2003-01-28 10:40 UTC (permalink / raw)


This is the code used to check "a timer of 10 seconds":
=================================================
with Ada.Real_Time;
with Ada.Text_io; use Ada.Text_io;
procedure time is
   function "-" ( LEFT  : in Ada.Real_time.TIME;
                  RIGHT : in Ada.Real_time.TIME )
     return Ada.Real_time.TIME_SPAN renames Ada.Real_time."-";

   function ">=" ( LEFT  : in Ada.Real_time.TIME_SPAN;
                  RIGHT : in Ada.Real_time.TIME_SPAN )
     return BOOLEAN renames Ada.Real_time.">=";

   TIME_OUT : constant Ada.Real_Time.Time_Span :=
Ada.Real_Time.Milliseconds(10000);
   BEGINNING_TIME : Ada.Real_Time.Time;
   DIFF_TIME     : Ada.Real_Time.Time_Span;
   PARTIAL_TIME  : Ada.Real_Time.Time;
   RESET_TIMER   : boolean := FALSE;
begin
   loop
      if not RESET_TIMER
      then
         --PUT("START TIMER");
         BEGINNING_TIME := Ada.Real_time.CLOCK;
         RESET_TIMER := TRUE;
      else
         --PUT("-");
         PARTIAL_TIME := Ada.Real_time.CLOCK;
         DIFF_TIME := PARTIAL_TIME - BEGINNING_TIME;
         if DIFF_TIME >= TIME_OUT
         then
            --PUT(" TIME OUT");
            exit;
         end if;
      end if;
   end loop;
end time;

========================================
The target is a processor x86 Family 6 Model 7 Stepping 3 AT/AT COMPATIBLE
The results change if I use video-outputs or not (PUT("START TIMER"),
PUT("-"), PUT("TIME OUT") are now commented into the code).
Why?
Thank you





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-28 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-28 10:40 Problems with a TIMER NERO
2003-01-28 18:36 ` Stephen Leake
2003-01-28 18:42 ` tmoran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox