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

* Re: Problems with a TIMER
  2003-01-28 10:40 Problems with a TIMER NERO
@ 2003-01-28 18:36 ` Stephen Leake
  2003-01-28 18:42 ` tmoran
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 2003-01-28 18:36 UTC (permalink / raw)


"NERO" <nero@hhhh.it> writes:

> This is the code used to check "a timer of 10 seconds":
> <snip>
> 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?

Because it takes time to execute Put ("-").

On the other hand, it is not clear exactly what you meant by
"results". If all the Text_IO is commented out, there is no output
from the program. I guess you must haved timed it in some other way.

-- 
-- Stephe



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

* Re: Problems with a TIMER
  2003-01-28 10:40 Problems with a TIMER NERO
  2003-01-28 18:36 ` Stephen Leake
@ 2003-01-28 18:42 ` tmoran
  1 sibling, 0 replies; 3+ messages in thread
From: tmoran @ 2003-01-28 18:42 UTC (permalink / raw)


> 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?
  In what way do the results change?  What compiler, OS, and motherboard
chip set do you have - see MS Knowledgebase article Q274323.
  There was a problem with certain chipsets and MS Windows that caused
the machine clock to appear to jump forward 2**24 ticks (several seconds)
if you did multiple clock reads with less than several microseconds
between them.  Gnat 3.15 fixed that, but introduced a new clock error,
which I reported and they say they've fixed for future versions.  Janus
has a version with the fix, but I don't know about other compilers.



^ 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