Import std.time.timers
Timer
class
Public Class Timer
Ticks of the monotonic clock, every so often, on the I/O thread's loop. A tick is never early, and comes as close after its time as the OS's timer lets it: within a couple of milliseconds on Linux and macOS, and within about 16 on Windows, whose timer ticks every 15.6 or so by default.
Examples
Local ticks = Timer.Every(10.Milliseconds, Instant.FromNanoseconds(0))
Expect(ticks.UntilNext(Instant.FromNanoseconds(4_000_000)) == 6.Milliseconds)
ticks.Stop()
Expect(ticks.IsStopped)
Timer.After(1.Milliseconds).Wait()-
A Task that's done once that long has passed, which Await, or Wait() on any thread, waits for. Wait and RealWait's Tasks, by contrast, are the main thread's coroutines'.
-
A Timer that ticks every interval from now, or from the Instant, which panics for an
intervalthat isn't above 0. -
@PanicsAtCaller Public Static Method Every(interval: Duration, start: Instant): Timerstatic method #A Timer that ticks every
intervalfromstart, which panics for an interval that isn't above 0. -
Whether it's stopped.
-
A Task that's done at its next tick after now, so a tick that's gone by while nothing waited is skipped, not caught up on. A stopped Timer's panics.
-
How long it is from
now, the Instant, to its next tick. -
Stops it, though a tick already asked for is still done.
Report an issue with this page or with FutureBlitz on GitHub.