Returns the amount of time that has passed since a static reference point.

result = Timer

Return Value:
Returns a double precision result with the time, in seconds, since a static reference point.

The Timer function is useful for finding out how long a section of code takes to run, or for control the timing of your code. To find out how much time has passed between two points in your program, you can record the value of Timer at the start and end points, and then subtract the start value from the end value.

On some platforms, the value of Timer resets to zero at midnight (see below), so if the start and end time are on either side of the reset point, the difference will be negative. This could cause unexpected behavior in some programs. In those cases, adding 86400 (the number of seconds in 24 hours) to the difference should return the correct result. If the time taken is longer than a day, then it will be also be necessary to check the number of days that have elapsed.

The value returned by Timer is NOT affected by the automatic changing of the system clock, in Spring and Autumn, for DST (Daylight Savings Time).

'' Example of using TIMER function
'' Note: see text about correct waiting strategies
Dim Start As Double
Print "Wait 2.5 seconds."
Start = Timer
    Sleep 1, 1
Loop Until (Timer - Start) > 2.5
Print "Done."

Platform Differences:

Differences from QB:
See also:
Back to Date and Time Functions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki

sf.net phatcode