Timer

From Br Wiki
Jump to: navigation, search
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