Summary
A very simple timer system based on a
System.Diagnostics.Stopwatch.- Assembly
- Animancer
.dll - Namespace
- Animancer
- Interfaces
-
- IDisposable
- Base Types
-
- ValueType
graph BT
Type-->Base0["ValueType"]
Type-.->Interface0["IDisposable"]
Type["SimpleTimer"]
class Type type-node
Syntax
public struct SimpleTimer : ValueType, IDisposable
Constructors
| Name | Summary |
|---|---|
| SimpleTimer |
Creates a new Animancer.SimpleTimer with the specified `name`. |
Fields
| Name | Constant Value | Summary |
|---|---|---|
| Default |
A default timer that hasn't been started.
static
|
|
| format |
The string format to use for
Animancer.SimpleTimer.ToString. |
|
| name |
An optional prefix for
Animancer.SimpleTimer.ToString. |
|
| startTicks |
The
System.Diagnostics.Stopwatch.ElapsedTicks from when this timer was started. |
|
| Stopwatch |
The system used to track time.
static
|
|
| totalTicks |
The total number of ticks that have elapsed since the
Animancer.SimpleTimer.startTicks. |
Properties
| Name | Value | Summary |
|---|---|---|
| IsStarted | bool |
Has
Animancer.SimpleTimer.Start been called and Animancer.SimpleTimer.Count not? |
| StartTimeSeconds | double |
Converts the
Animancer.SimpleTimer.startTicks to seconds. |
| TotalTimeSeconds | double |
Converts the
Animancer.SimpleTimer.totalTicks to seconds. |
Methods
| Name | Value | Summary |
|---|---|---|
| Cancel |
void |
Clears the
Animancer.SimpleTimer.startTicks. |
| Count |
long |
Calculates the amount of time that has passed since the
Animancer.SimpleTimer.startTicks
and returns it after adding it to the Animancer.SimpleTimer.totalTicks.
Also resumes this timer.
|
| Dispose |
void |
Logs
Animancer.SimpleTimer.ToString and calls Animancer.SimpleTimer.Cancel. |
| Format |
string |
Converts the given `ticks` to a string using the
Animancer.SimpleTimer.format. |
| Start |
void |
Stores the
System.Diagnostics.Stopwatch.ElapsedTicks in Animancer.SimpleTimer.startTicks
so that Animancer.SimpleTimer.Count will be able to calculate how much time has passed.
|
| Start |
SimpleTimer |
Creates a new
Animancer.SimpleTimer with the specified `name` and starts it.static
|
| ToString |
string |
Calls
Animancer.SimpleTimer.Count and returns a string describing the current values of this timer. |