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

Timer( format, decimals )

Includes: String()

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 integer How many decimals each time should contain

Methods

Jump To top reset elapsed toString is

reset()

Returns: N/A (undefined)

Name Type Purpose

Resets the elapsed time to the current moment.


elapsed()

Returns: integer (0..)

Name Type Purpose

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


toString()

Returns: N/A (undefined)

Name Type Purpose

Returns the elapsed time as a formatted StringTime.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type struct id The structure type to compare this against

Returns true if the provided type is Timer.


Variables

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