#include <ariaUtil.h>
This class is for timing durations or time between events. The time values it stores are relative to an abritrary starting time; it does not correspond to "real world" or "wall clock" time in any way, so DON'T use this for keeping track of what time it is, just for timestamps and relative timing (e.g. "this loop needs to sleep another 100 ms").
The recommended methods to use are setToNow() to reset the time, mSecSince() to obtain the number of miliseconds elapsed since it was last reset (or secSince() if you don't need milisecond precision), and mSecSince(ArTime) or secSince(ArTime) to find the difference between two ArTime objects.
Definition at line 673 of file ariaUtil.h.
Public Member Functions | |
void | addMSec (long ms) |
Add some milliseconds (can be negative) to this time. | |
ArTime () | |
Constructor. | |
time_t | getMSec (void) const |
Gets the milliseconds value (occuring after the seconds value). | |
time_t | getSec (void) const |
Gets the seconds value (since the arbitrary starting time). | |
bool | isAfter (ArTime testTime) const |
returns whether the given time is after this one or not | |
bool | isAt (ArTime testTime) const |
returns whether the given time is equal to this time or not | |
bool | isBefore (ArTime testTime) const |
returns whether the given time is before this one or not | |
void | log (void) const |
Logs the time. | |
long | mSecSince (void) const |
Finds the number of milliseconds from this timestamp to now. | |
long | mSecSince (ArTime since) const |
Gets the number of milliseconds since the given timestamp to this one. | |
long | mSecTo (void) const |
Finds the number of millisecs from when this timestamp is set to to now (the inverse of mSecSince()). | |
long | secSince (void) const |
Finds the number of seconds from when this timestamp was set to now. | |
long | secSince (ArTime since) const |
Gets the number of seconds since the given timestamp to this one. | |
long | secTo (void) const |
Finds the number of seconds from when this timestamp is set to to now (the inverse of secSince()). | |
void | setMSec (time_t msec) |
Sets the milliseconds value (occuring after the seconds value). | |
void | setSec (time_t sec) |
Sets the seconds value (since the arbitrary starting time). | |
void | setToNow (void) |
Resets the time. | |
~ArTime () | |
Destructor. | |
Protected Attributes | |
time_t | myMSec |
time_t | mySec |