Skip to content
Hyomoto edited this page Dec 12, 2020 · 17 revisions
Jump To Go Back Arguments Methods Variables

Timer( format, decimals )

Implements: None

Timer provides the difference between two times in your program, when it is created and when it is checked. It can be used to get the elapsed time or as a formatted string.

var _timer = new Timer( "$S seconds", 2 );

if ( _timer.elapsed() > 100000 ) {
  show_debug_message( string( _timer ) );
}

Arguments

Name Type Purpose
format string The display format, $H, $M and $S will be replaced with hours, minutes, and seconds
decimals int How many decimals each time unit should contain

Methods

Jump To top reset elapsed toString is

reset()

Returns: N/A undefined

Name Type Purpose
None

Resets the elapsed time to the current moment.


elapsed()

Returns: int (0..)

Name Type Purpose
None

Returns the time elapsed between the start time and now, in microseconds.


toString()

Returns: string ("string")

Name Type Purpose
None

Returns the elapsed time as a formatted StringTime-formatted string.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is Timer.


Variables

Jump To top
  • content - the internal StringTime that is used to format the elapsed time
  • start - the moment the timer was last started, either when it was created or the last reset()
Clone this wiki locally