Class StopwatchBase
Base class for stopwatches.
Inheritance
Implements
Namespace: System.Time
Assembly: Nuqleon.Time.dll
Syntax
public abstract class StopwatchBase : Object, IStopwatch
Constructors
StopwatchBase()
Declaration
protected StopwatchBase()
Properties
Elapsed
Gets the total elapsed time measured by the current instance.
Declaration
public TimeSpan Elapsed { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
ElapsedMilliseconds
Gets the total elapsed time measured by the current instance, in milliseconds.
Declaration
public long ElapsedMilliseconds { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ElapsedTicks
Gets the total elapsed time measured by the current instance, in timer ticks.
Declaration
public long ElapsedTicks { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
IsHighResolution
Gets a value indicating whether the stopwatch supports high resolution timing.
Declaration
protected abstract bool IsHighResolution { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRunning
Gets a value indicating whether the stopwatch timer is running.
Declaration
public bool IsRunning { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
TickFrequency
Gets the tick frequency if the stopwatch supports high resolution timing.
Declaration
protected abstract double TickFrequency { get; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
GetElapsedDateTimeTicks()
Gets the high-resolution ticks as DateTime.Ticks if the stopwatch is using a high-resolution counter.
Declaration
protected virtual long GetElapsedDateTimeTicks()
Returns
Type | Description |
---|---|
System.Int64 | High-resolution ticks converted to DateTime.Ticks. |
GetRawElapsedTicks()
Gets the total elapsed time, including the time since the stopwatch was last started.
Declaration
protected long GetRawElapsedTicks()
Returns
Type | Description |
---|---|
System.Int64 | The total elapsed time, including the time since the stopwatch was last started. |
GetTimestamp()
Gets the current number of ticks in the timer mechanism.
Declaration
public abstract long GetTimestamp()
Returns
Type | Description |
---|---|
System.Int64 | A long integer representing the tick counter value of the underlying timer mechanism. |
Reset()
Stops time interval measurement and resets the elapsed time to zero.
Declaration
public void Reset()
Restart()
Stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time.
Declaration
public void Restart()
Start()
Starts, or resumes, measuring elapsed time for an interval.
Declaration
public void Start()
Stop()
Stops measuring elapsed time for an interval.
Declaration
public void Stop()