FAQ012: How to delay.
Got these results using the program below:
Seconds: 7200
7200.066
Not bad, considering that I minimized the DOS Window and did other stuff.
Conclusion: We finally have a delay routine that works for any interval of time > .054 second - Even 999999 (About 11.5 days) even if daylight savings time changes or the user manually resets the clock for some reason. And of course, no problem crossing midnight.
Mac
DECLARE SUB Delay (Seconds AS SINGLE)
DO
INPUT "Seconds: ", s: IF s = 0 THEN SYSTEM
t = TIMER: Delay s: PRINT TIMER - t
LOOP
SUB Delay (Seconds AS SINGLE)
DIM Goal AS LONG: Goal = Seconds * 256
DIM Elapsed AS LONG, t1 AS LONG, t2 AS LONG
t1 = TIMER * 256
DO
DO: t2 = TIMER * 256: LOOP WHILE t2 = t1
IF ABS(t2 - t1) < 200 THEN
Elapsed = Elapsed + t2 - t1
ELSE
Elapsed = Elapsed + 14
END IF
t1 = t2
LOOP WHILE INKEY$ = "" AND Elapsed < Goal
END SUB