Difference between revisions of "TIMER"

From QB64 Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
It can return single values down to about .05 seconds accurately.
 
It can return single values down to about .05 seconds accurately.
 
Values range from 0 at midnite to 86399.
 
Values range from 0 at midnite to 86399.
 +
  
 
''Example 1:'' 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!  
 
''Warning:'' TIMER value comparison ranges cannot exceed 86399!  
 
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:'' Midnite adjustment:
 
''Example 2:'' Midnite adjustment:

Revision as of 04:24, 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