std-timer-start, std-timer-stop | ![]() |
(std-timer-start) ; => timer, starts the stopclock
(std-timer-stop timer) ; elapses milliseconds
They are used to compute the elapsed time in milliseconds.
Nested or incremental timer calls are supported by the timer argument to STD-TIMER-STOP
. If the timer argument is nil the number of milliseconds since the last call to STD-TIMER-START
is returned, otherwise the difference to the given timer argument.
Sideeffects
Both functions maybe used in a purely functional way, but you may also use both symbols for side-effects only. However, the interpretation of *STD:TIMER-START* is system dependent and not guaranteed to be exact milliseconds. It is normally only usable for numerical differences.
(std-timer-start) (std-sleep 0.5) (std-princ (list "waited " (std-timer-stop nil) " ms"))
or:
(setq t1 (std-timer-start)) (repeat 5 (std-timer-start)(std-sleep 0.1) (princ (std-timer-stop nil))) (std-princ (list "\nsummary: " (std-timer-stop t1) " ms"))
timer: Must be the return value from std-timer-start. This is usually a number (int or real).
STD-TIMER-START
returns a timer, usually a number (int or real) in milliseconds.
STD-TIMER-STOP
returns a number (int or real) in milliseconds.
Sets and reads the global symbol *STD:TIMER-START*
.
STD-TIMER-START
stores a time number (units milliseconds) in a global symbol *STD:TIMER-START*
to support the nil argument.
(std-require 'STDTIME)
Defined in STDTIME