Time a function: Difference between revisions

Added BaCon
(Added FreeBASIC)
(Added BaCon)
Line 270:
Sleep 1000
}</lang>
 
=={{header|BaCon}}==
The BaCon '''TIMER''' function keeps track of time spent running, in milliseconds (which is also the time unit used by '''SLEEP'''). This is not process specific, but a wall clock time counter which starts at 0 during process initialization. As BaCon can easily use external C libraries, process specific ''CLOCK_PROCESS_CPUTIME_ID'' '''clock_gettime''' could also be used.
 
<lang freebasic>' Time a function
SUB timed()
SLEEP 7000
END SUB
 
st = TIMER
timed()
et = TIMER
PRINT st, ", ", et</lang>
 
{{out}}
<pre>prompt$ ./time-function
0, 7000</pre>
 
=={{header|BASIC}}==
Anonymous user