Import std.time.clock
Stopwatch
class
Public Class Stopwatch
Measures how long goes by while it runs, over as many starts and stops as it has.
Examples
Local start = Instant.FromNanoseconds(0)
Local watch = Stopwatch.StartNew(start)
Expect(watch.ElapsedAt(Instant.FromNanoseconds(1_500_000)) == 1500.Microseconds)
watch.Stop(Instant.FromNanoseconds(2_000_000))
Expect(watch.Elapsed == 2.Milliseconds && !watch.IsRunning)-
A Stopwatch at 0 that isn't running.
-
A Stopwatch running from now, or from the Instant.
-
A Stopwatch running from
now. -
Whether it's running.
-
What it's measured, now or at the Instant.
-
What it's measured at
now. -
Starts it, now or at the Instant, unless it's running.
-
Starts it at
now, unless it's running. -
Stops it, now or at the Instant, keeping what it measured, unless it's stopped.
-
Stops it at
now, keeping what it measured, unless it's stopped. -
Stops it at 0.
-
Starts it again from 0, now or at the Instant.
-
Starts it again from 0, at
now.
Report an issue with this page or with FutureBlitz on GitHub.