Profiling - Time to Perform Tasks
A common task is to compare the time taken to run a series of statements. With TIMER, the answer can be retuned with an accuracy of about 0.01 seconds - accurate, but not extremely so. Repeating the code block many times is usually done when TIMER is used.
When only a relative comparison is acceptable, the use of TIX (CPU cycles) can get very high resolution comparisons, but timing is unknown.
For high resolution clock time, use the Windows GetTickCount API.
String Function Listing
Here's a simple listing of the date/time functions above, with a one-line description of what the function does. Syntax and examples are given in the next section.
Date/Time Functions Reference
Here are examples for each of the date/time functions. The functions are listed in alphabetical order.
a$ = DATE$ 'returns system data DATE$ = a$ 'set system date a$ formats: mm-dd-yy mm/dd/yy mm-dd-yyyy mm/dd/yyyy
sleep 3000 'pause for 3 seconds
a$ = TIME$ 'returns system time : hh:mm:ss TIME$ = a$ 'set system time (hh:mm:ss) TIME$ = "08:40:00" ' 8:40am TIME$ = "08" ' 8am TIME$ = "15:30" ' 3:30pm TIME$ = "0:01" ' 1 min after midnight
Time is in 24-hour format.
ElapsedSeconds = TIMER 'seconds since midnight
Return data type is double precision. Resolution is about 1/100 of a second.
TIX Cycles&& ' Cycles&& has current value of counter TIX END Cycles&& ' Cycles&& is delta since first call
If you have any suggestions or corrections, please let me know.