home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
TIMING2.ZIP
/
TIMETEST.BAS
< prev
Wrap
BASIC Source File
|
1989-09-12
|
2KB
|
55 lines
'TIMETEST.BAS
'----------------------------------------------------------------------------
' This program does nothing more than demonstrate the two timing
' SubPrograms, DELAY & BGDELAY
'----------------------------------------------------------------------------
DECLARE SUB DELAY (hun.scnds!)
DECLARE SUB BGDELAY (hun.scnds!, HUN.SCNDS.TO.GO!, status%)
'/--------------------------------------------------------------------------/
' First, the simpler DELAY. This SubProgram is CALLed with one
' SINGLE PRECISION (*!*) argument and retains control until that
' many hundredths of seconds pass.
'/--------------------------------------------------------------------------/
COLOR 14: PRINT "First test: `hard' delay"
COLOR 7: PRINT " how many hundredths of seconds? :";
LOCATE , , 1: LINE INPUT tmp$
PRINT " Starting time: "; TIME$
time.to.wait! = VAL(tmp$) 'wait for 5 seconds
CALL DELAY(time.to.wait!)
PRINT " Ending time : "; TIME$
'/--------------------------------------------------------------------------/
' Second, BGDELAY. This SubProgram is CALLed with two SINGLE PRECISION (*!*)
' arguments, and one integer argument: the first S.P. argument tells
' BGDELAY how many hundredths of seconds are to be delayed; the second
' S.P. argument is for BGDELAY to tell you how many hundredths of
' seconds remain until the timeout has occurred. The third argument, the
' integer, tells you whether or not the timing is continuing. Once the
' third argument falls to 0, the timing is done (ie, a timeout has
' occurred) less than or equal to 0, then the timeout has occurred!
'/--------------------------------------------------------------------------/
PRINT
COLOR 14: PRINT "Next test: `background' delay"
COLOR 7: PRINT " how many hundredths of seconds? :";
LOCATE , , 1: LINE INPUT tmp$
PRINT " Starting time: "; TIME$
time.to.wait! = VAL(tmp$) 'wait for 5 seconds
DO
GOSUB mything 'go do your thing while waiting
CALL BGDELAY(time.to.wait!, time.to.go!, st%)
LOOP UNTIL st% = 0
PRINT
PRINT " Ending time : "; TIME$
END
mything:
'---- Do anything you want here, but DON'T change the value of ST% !!
LOCATE CSRLIN, 1
PRINT " Current time : "; TIME$, , "1/100 seconds left:"; FIX(time.to.go!);
RETURN