Difference between revisions of "TIMER"

From QB64 Wiki
Jump to navigation Jump to search
Line 8: Line 8:
 
If a comparison value is used it must fall within that range!
 
If a comparison value is used it must fall within that range!
  
''Example 2:''  
+
''Example 2:'' Midnite adjustment:
  
 
SUB Delay (dlay!)
 
SUB Delay (dlay!)

Revision as of 04:23, 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: Midnite adjustment:

SUB Delay (dlay!)

start! = TIMER

DO WHILE start! + dlay! >= TIMER

IF start! > TIMER THEN start! = start! - 86400

LOOP

END SUB