Implement a passive timer, with time accuracy in seconds.You have to start, stop, restart, and check the remaining time yourself. The timer can be paused, then re-started. More...
#include <Timer.hh>
Public Member Functions | |
| Timer (int allowed_time) | |
| void | setAllowedTime (int allowed_time) |
| Set the maximum allowed time, in second. | |
| int | getAllowedTime () const |
| Get the allowed time. | |
| int | getTimeRemaining () const |
| Get the remaining time, in seconds. | |
| bool | isTimeElapsed () const |
| Check is the time is elapsed. | |
| bool | isPaused () const |
| Check if the timer is paused. | |
| void | start () |
| Start the timer. | |
| void | stop () |
| Stop the timer. | |
| void | restart () |
| Restart the timer. This is equivalent to calling stop then start. | |
| void | pause () |
| Do a pause. | |
Implement a passive timer, with time accuracy in seconds.
You have to start, stop, restart, and check the remaining time yourself. The timer can be paused, then re-started.
Currently, the timer has a second precision. Something more accurate (ie milliseconds) should be implemented, but for the time being this ssufficient.
| int Timer::getTimeRemaining | ( | ) | const |
Get the remaining time, in seconds.
Referenced by SMatch::checkForCurrentOpponentChoice(), isTimeElapsed(), Api::remainingTime(), and SMatch::waitForCurrentOpponentChoice().
| bool Timer::isPaused | ( | ) | const |
Check if the timer is paused.
Referenced by SMatch::checkForCurrentOpponentChoice(), Api::isTimerPaused(), and SMatch::waitForCurrentOpponentChoice().
| bool Timer::isTimeElapsed | ( | ) | const |
Check is the time is elapsed.
References getTimeRemaining().
Referenced by SRules::serverProcess().
| void Timer::pause | ( | ) |
Do a pause.
start, not restart. Referenced by SMatch::waitForCurrentOpponentChoice().
| void Timer::setAllowedTime | ( | int | allowed_time | ) |
Set the maximum allowed time, in second.
1.6.3