Skip to content
CShift0.32

Stopwatch

Struct · namespace System · Since 0.19

struct Stopwatch

Measures elapsed time with the monotonic clock of the system (not affected by changes of the time of day).

Name Description
StartNew A new stopwatch that is running.
static Stopwatch StartNew()

A new stopwatch that is running.

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.

void Restart()

Sets the elapsed time to zero and starts measuring.

bool IsRunning()

Whether the stopwatch is measuring.

int64 ElapsedTicks()

The elapsed time in ticks of 100 ns.

int64 ElapsedMilliseconds()

The elapsed time in milliseconds.

TimeSpan Elapsed()

The elapsed time.