Code: Select all
SLEEP 1000
Or does it relate to the manufacturers pc processor per computer?
Code: Select all
SLEEP 1000
Code: Select all
dim as double tStart=Timer()
Sleep(1000)
dim as double tEnd=Timer()
print tEnd-tStart
sleep
Didn't work?D.J.Peters wrote:try it out :-)
Code: Select all
dim as double tStart=Timer() Sleep(1000) dim as double tEnd=Timer() print tEnd-tStart sleep
I want to grant a one sec window to allow for user intervention...Compiler output:
: error 11: Expected constant
Dim As Double tStart=Timer()
^
Code: Select all
PRINT "[SPACEBAR] = reset Codes"
a$ = ""
sleep 1000
a$ = INKEY$:
IF a$ = CHR$(32) THEN KILL "fields.cfg"
sleep
Code: Select all
mygo:
t=fix(timer)+1
do
a$=""
sleep 1
a$=inkey$
if a$<>"" then exit do
loop while t>fix(timer)
if a$<>"" then
if a$="1" then print "user intervention program" else print "other 2 etc"
else
print "slide on through to main program"
end if
goto mygo:
The problem is sometimes SLEEP counts in seconds.anonymous1337 wrote:Sleep rests in milliseconds, or until a key is pressed.
Yes I am using FB.counting_pine wrote:FB doesn't have a 16-bit mode!
...
Just make sure you're using FB!
(Sorry if i messed up the quote thing. The quote buttons don't seem to like me)SYNTAX
SLEEP [milliseconds]
Description
SLEEP will wait until the 'milliseconds' given elapsed (if any value was passed) or until the user presses a key (unless 'milliseconds' is below 100ms).
EXAMPLE
PRINT "press a key"
SLEEP
getkey 'clear the keyboard buffer
PRINT "waiting half second"
SLEEP 500
The accuracy of SLEEP is variable depending on the OS cycle time (Windows NT/2K/XP: 15 ms, 9x/Me: 50 ms, Linux 10ms, DOS 55 ms).
The delay had to be given in seconds in QB
The input buffer is not cleared when using the multi-threading version of the run-time library
bc.exe is nothing to do with FreeBASIC. It's probably the QuickBASIC compiler. Don't expect its Sleep to behave the same way.jiranz wrote:Yes I am using FB.
Maybe i should explain that I ran the same code through bc.exe and fbc.exe and got different results for SLEEP.
Also I do not have the SLEEP parameters you refer to?