A class to handle timeout events. More...
#include <Timeout.h>
Public Member Functions | |
Timeout () | |
Creates an empty timeout. More... | |
void | setTimeout (unsigned long timeout) |
Sets a timeout threshold in milliseconds. More... | |
unsigned long | timeout () const |
Returns current timeout threshold. More... | |
void | refresh () |
Refreshes the timeout. More... | |
bool | timeoutReached () const |
Returns true if timeout is reached. | |
unsigned long | timeToTimeout () const |
Returns the timer's remaining value in milliseconds left until the timeout. | |
unsigned long | timeElapsedFromLastRefresh () const |
Returns the elapsed time from last refresh. | |
float | percentage () const |
Returns the percentage of the timeout. More... | |
A class to handle timeout events.
This class permits to handle in an easy way any timeout event
|
inline |
Creates an empty timeout.
The timeout will be set to 0. Use setTimeout() to specify a timeout threshold
float Tinker::Timeout::percentage | ( | ) | const |
Returns the percentage of the timeout.
Varies from 0 to 1.
0 -> timeout refreshed
1 -> timeout reached
void Tinker::Timeout::refresh | ( | ) |
Refreshes the timeout.
Resets the counter avoiding the timeout to be reached
|
inline |
Sets a timeout threshold in milliseconds.
timeout | threshold in milliseconds |
|
inline |
Returns current timeout threshold.