Difference between revisions of "TIMER"

From QB64 Wiki
Jump to navigation Jump to search
(Created page with ''''TIMER''' returns the number of seconds past the previous midnite. It can return single values down to about .05 seconds accurately. Values range from 0 at midnite to 86399. …')
 
Line 3: Line 3:
 
Values range from 0 at midnite to 86399.
 
Values range from 0 at midnite to 86399.
  
''Example:'' t! = TIMER + 1: DO: LOOP UNTIL TIMER > t! 'one second delay
+
''Example 1:'' t! = TIMER + 1: DO: LOOP UNTIL TIMER > t! 'one second delay
 +
 
 +
''Warning:'' TIMER value comparison ranges cannot exceed 86399!
 +
If a comparison value is used it must fall within that range!
 +
 
 +
''Example 2:''
 +
SUB Delay (dlay!)
 +
start! = TIMER
 +
DO WHILE start! + dlay! >= TIMER
 +
IF start! > TIMER THEN start! = start! - 86400
 +
LOOP
 +
END SUB

Revision as of 04:20, 28 August 2009

TIMER returns the number of seconds past the previous midnite. It can return single values down to about .05 seconds accurately. Values range from 0 at midnite to 86399.

Example 1: t! = TIMER + 1: DO: LOOP UNTIL TIMER > t! 'one second delay

Warning: TIMER value comparison ranges cannot exceed 86399! If a comparison value is used it must fall within that range!

Example 2: SUB Delay (dlay!) start! = TIMER DO WHILE start! + dlay! >= TIMER IF start! > TIMER THEN start! = start! - 86400 LOOP END SUB