SimpleTimer Struct

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(string) Creates a new Animancer.SimpleTimer with the specified `name`.

Fields

Name Constant Value Summary
name
An optional prefix for Animancer.SimpleTimer.ToString.
startTime
The Animancer.SimpleTimer.CurrentTime from when this timer instance was started.
Stopwatch
The system used to track time.
static
total
The total amount of time this timer instance has been running (in seconds).

Properties

Name Value Summary
CurrentTime double
The amount of time that has passed (in seconds) since the first timer was started.
static
IsStarted bool
Has Animancer.SimpleTimer.Start been called and Animancer.SimpleTimer.Stop not?

Methods

Name Value Summary
Dispose() void
Calls Animancer.SimpleTimer.ToString and logs the result.
Start() bool
Stores the Animancer.SimpleTimer.CurrentTime in Animancer.SimpleTimer.startTime so that Animancer.SimpleTimer.Stop will be able to calculate how much time has passed.
Start(string) SimpleTimer
Creates a new Animancer.SimpleTimer with the specified `name` and starts it.
static
Stop() bool
Adds the amount of time that has passed since the Animancer.SimpleTimer.startTime to the Animancer.SimpleTimer.total and clears the Animancer.SimpleTimer.startTime.
ToString() string
Calls Animancer.SimpleTimer.Stop and returns a string representation of the Animancer.SimpleTimer.total.