Class Timer
Timer class
Syntax
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
Constructors
Timer()
Initializes a new instance of the Timer class.
Declaration
Timer
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
Methods
getHiResTimer()
Gets a high resolution timer in seconds.
Declaration
Float getHiResTimer()
Returns
Type | Description |
---|---|
Float |
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
getSeconds()
This function will return the number of seconds between start and stop.
Declaration
Float getSeconds()
Returns
Type | Description |
---|---|
Float | The number of seconds between start and stop. |
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
getTimer()
Gets a timer value in seconds from the real time system clock. This is normally a low resolution timer.
Declaration
Float getTimer()
Returns
Type | Description |
---|---|
Float |
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
start()
This function will start the timer.
Declaration
Void start()
Returns
Type | Description |
---|---|
Void |
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();
stop()
This function will stop the timer.
Declaration
Void stop()
Returns
Type | Description |
---|---|
Void |
Examples
Timer timer;
timer.start();
// code you want to time
timer.stop();
Float timeTaken = timer.getSeconds();