Table of Contents

Class TimerTick

Namespace
Stride.Games.Time
Assembly
Stride.Games.dll

This provides timing information similar to Stopwatch but an update occurring only on a Tick() method.

public class TimerTick
Inheritance
object
TimerTick

Constructors

TimerTick()

Initializes a new instance of the TimerTick class.

public TimerTick()

TimerTick(TimeSpan)

Initializes a new instance of the TimerTick class.

public TimerTick(TimeSpan startTime)

Parameters

startTime TimeSpan

The start time.

Properties

ElapsedTime

Gets the elapsed time since the previous call to Tick().

public TimeSpan ElapsedTime { get; }

Property Value

TimeSpan

ElapsedTimeWithPause

Gets the elapsed time since the previous call to Tick() including Pause()

public TimeSpan ElapsedTimeWithPause { get; }

Property Value

TimeSpan

IsPaused

Gets a value indicating whether this instance is paused.

public bool IsPaused { get; }

Property Value

bool

true if this instance is paused; otherwise, false.

SpeedFactor

Gets or sets the speed factor. Default is 1.0

public double SpeedFactor { get; set; }

Property Value

double

The speed factor.

StartTime

Gets the start time when this timer was created.

public TimeSpan StartTime { get; }

Property Value

TimeSpan

TotalTime

Gets the total time elasped since the last reset or when this timer was created.

public TimeSpan TotalTime { get; }

Property Value

TimeSpan

TotalTimeWithPause

Gets the total time elasped since the last reset or when this timer was created, including Pause()

public TimeSpan TotalTimeWithPause { get; }

Property Value

TimeSpan

Methods

Pause()

Pauses this instance.

public void Pause()

Reset()

Resets this instance. TotalTime is set to zero.

public void Reset()

Reset(TimeSpan)

Resets this instance. TotalTime is set to startTime.

public void Reset(TimeSpan startTime)

Parameters

startTime TimeSpan

The start time.

Resume()

Resumes this instance, only if a call to Pause() has been already issued.

public void Resume()

Tick()

Update the TotalTime and ElapsedTime,

public void Tick()

Remarks

This method must be called on a regular basis at every tick.