Stopwatch
Struct · namespace System · Since 0.19
struct StopwatchMeasures elapsed time with the monotonic clock of the system (not affected by changes of the time of day).
Static methods
Section titled “Static methods”| Name | Description |
|---|---|
StartNew |
A new stopwatch that is running. |
StartNew
Section titled “StartNew”static Stopwatch StartNew()A new stopwatch that is running.
Methods
Section titled “Methods”| Name | Description |
|---|---|
Start |
Starts measuring (or continues after Stopwatch.Stop). |
Stop |
Stops measuring; the elapsed time stays. |
Reset |
Stops measuring and sets the elapsed time to zero. |
Restart |
Sets the elapsed time to zero and starts measuring. |
IsRunning |
Whether the stopwatch is measuring. |
ElapsedTicks |
The elapsed time in ticks of 100 ns. |
ElapsedMilliseconds |
The elapsed time in milliseconds. |
Elapsed |
The elapsed time. |
void Start()Starts measuring (or continues after Stopwatch.Stop).
void Stop()Stops measuring; the elapsed time stays.
void Reset()Stops measuring and sets the elapsed time to zero.
Restart
Section titled “Restart”void Restart()Sets the elapsed time to zero and starts measuring.
IsRunning
Section titled “IsRunning”bool IsRunning()Whether the stopwatch is measuring.
ElapsedTicks
Section titled “ElapsedTicks”int64 ElapsedTicks()The elapsed time in ticks of 100 ns.
ElapsedMilliseconds
Section titled “ElapsedMilliseconds”int64 ElapsedMilliseconds()The elapsed time in milliseconds.
Elapsed
Section titled “Elapsed”TimeSpan Elapsed()The elapsed time.