Timer: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
  TIMER
  TIMER


The '''Timer''' [[internal function]] returns a "Real Number" with 5 decimal digits accuracy with the number of seconds elapsed since a point in time roughly around 1970.
The '''Timer''' [[internal function]] returns a "Real Number" with 5 decimal digits accuracy with the number of seconds elapsed since midnight, January 1, 1970.


* Most Likely this starting point is related to the [[operating system]].
* This starting point is obtained from the [[operating system]] so it is only as accurate as your system time.


This value is used internally by the pro filer to monitor performance, but may be used within programs to measure the time very accurately
This value is used internally by the pro filer to monitor performance, but may be used within programs to measure the time very accurately

Latest revision as of 15:55, 8 June 2015

TIMER

The Timer internal function returns a "Real Number" with 5 decimal digits accuracy with the number of seconds elapsed since midnight, January 1, 1970.

  • This starting point is obtained from the operating system so it is only as accurate as your system time.

This value is used internally by the pro filer to monitor performance, but may be used within programs to measure the time very accurately

The function works as far back as 4.1x.

Simple Example:

PRINT TIMER
Returns:  1305192990.17052

The following example shows the timer value, and converts it to various units "Minutes" "Hours" "Years". It also shows the total time elapsed for this program. (It usually returns 0.0156004) With 1 Attempt.

00001   PRINT Newpage
00010   LET Tot_Time=Timer
00020   PRINT "Timer:",Tot_Time
00030   PRINT "Minutes:",Int(Tot_Time/60)
00040   PRINT "Hours:",Int(Tot_Time/(60*60))
00050   PRINT "Years:",(Tot_Time/(60*60*24*365))
00060   LET New_Time=Timer
00065   IF (New_Time-Tot_Time)=0 THEN LET Attempts+=1 : GOTO 60
00070   PRINT "Time Elapsed: (";Attempts+1;")",New_Time-Tot_Time