Skip to main content

Timer

A Timer is used to track elapsed time.

Example


var timer = Timer() // Create a time instance and starts it
var elapsed = timer.elapsed() // The time since it started.
print(elapsed.milliseconds)
var elapsed2 = timer.elapsed() // Can be invoker multiple time
timer.reset() // Restart the timer from this point.

Constructors

Timer() -> Timer

Creates a new Timer instance and starts it.

Members

NameDescription
elapsedReturns the elapsed time since the timer was started.
resetResets the starting time of the timer.