Board index » delphi » Problem with Delay procedure on 486s

Problem with Delay procedure on 486s

Hi,

I am using the DELAY library procedure in a Borland Pascal program.  This has
been working on older PCs, but it no longer works on a 486.  The problem is
that the delay is now executed much faster than before  (ie a delay of 10 secs
is now 6 secs or less).  Is there a way around this?

Thanks,
Susan.

--
+-----------------------------------------------------------+
|  Susan Mitchell                                           |
|  mitch...@sun1.alcatel.oz.au                              |
+-----------------------------------------------------------+

 

Re:Problem with Delay procedure on 486s


Use interrupt 1c to write a real-time timer.  I am sure there is an
example in one of the archives...

--
Chris Kushmerick
<ckushmer...@ccmail.sunysb.edu>

Re:Problem with Delay procedure on 486s


Quote
mitch...@sun1alcatel.oz.au (Susan Mitchell) wrote:

> Hi,

> I am using the DELAY library procedure in a Borland Pascal program.  This has
> been working on older PCs, but it no longer works on a 486.  The problem is
> that the delay is now executed much faster than before  (ie a delay of 10 secs
> is now 6 secs or less).  Is there a way around this?

> Thanks,
> Susan.

> --
> +-----------------------------------------------------------+
> |  Susan Mitchell                                           |
> |  mitch...@sun1.alcatel.oz.au                              |
> +-----------------------------------------------------------+

Yes, try using the GetTime procedure from the DOS unit. It's not as
accurate (1/100 second resolution), but it's independent of the
machine's speed :

Procedure NewDelay (Time : LongInt);   { Time in 1/100 seconds }

Var
  StartHour, StartMinute, StartSecond, StartSec100,
  CurHour, CurMinute, CurSecond, Cur100 : Word;  
  Start, Current : LongInt;

Begin
  GetTime (Hour,Minute,Second,Sec100);
  Start:=360000*LongInt (Hour)+6000*LongInt (Minute)+
            100*LongInt (Second)+Sec100;
  Current:=Start;
  While (Current-Start)<Time Do Begin
    GetTime (Hour,Minute,Second,Sec100);
    Current:=360000*LongInt (Hour)+6000*LongInt (Minute)+
                100*LongInt (Second)+Sec100;
  End;
End;

The only time when this procedure doesn't work is when the While loop
is being executed and midnight passes, but you'll probably be able
to work around that.

Ciao,
s795...@dutiws.twi.tudelft.nl

Other Threads