l0.DependencyControl.Timer¶
Timer ¶
Timer with monotonic clock readings and millisecond sleep. Not affected by system clock changes.
Constructor ¶
Creates a new timer, running from the current time.
Instance methods¶
start ¶
Resumes measurement from the current time. No-op if already running, so a prior stop/start round trip never discards accumulated time.
Returns:
selfTimer — for chaining
stop ¶
Pauses measurement, folding the elapsed interval into the accumulated total. No-op if already stopped.
Returns:
selfTimer — for chaining
reset ¶
Clears the accumulated time and restarts measuring from the current time, preserving the running/stopped state.
Returns:
selfTimer — for chaining
Class methods¶
sleep ¶
Sleeps for the given number of milliseconds.
| param | type | description |
|---|---|---|
| ms | number |
getTime ¶
Returns the current value of the process's monotonic clock, in milliseconds, at sub-millisecond resolution. Only differences between readings are meaningful.
Returns:
millisecondsnumber
Fields¶
| field | type | description |
|---|---|---|
| elapsed | number |
Milliseconds measured so far, excluding any intervals during which the timer was stopped. Read-only. |