ATLAS Offline Software
|
Helper class to divide time into intervals aligned with wall clock Once object is constructed say with arguments (6, 10, seconds) the time gets divided into 6 intervals each of 10s long. More...
#include <TimeDivider.h>
Public Types | |
enum | unit { seconds, minutes } |
Public Member Functions | |
TimeDivider (unsigned int intervals, unsigned int duration, unit u) | |
construct the TimeDivider More... | |
bool | isPassed (time_t time, unsigned int &newinterval, unsigned int &oldinterval) |
method to know if one shoudl switch to new interval More... | |
unsigned int | forcePassed (time_t time, unsigned int &oldinterval) |
method More... | |
Private Attributes | |
unsigned int | m_intervals |
unsigned int | m_duration |
unit | m_unit |
unsigned int | m_current_interval |
time_t | m_beginning |
Helper class to divide time into intervals aligned with wall clock Once object is constructed say with arguments (6, 10, seconds) the time gets divided into 6 intervals each of 10s long.
If method isPassed is then called say for 17:00:01 it returns false and interval argument is set to 0, When next time function is called at 17:00:09 retult is the same. However if next call happens at 17:00:11 one gets return value == true and new interval == 1.
Definition at line 20 of file TimeDivider.h.
enum TimeDivider::unit |
TimeDivider::TimeDivider | ( | unsigned int | intervals, |
unsigned int | duration, | ||
unit | u | ||
) |
construct the TimeDivider
intervals | defines number of intervals we want to divide time into |
duration | of the time interval |
u | is unit (either seconds or minutes) |
Definition at line 10 of file TimeDivider.cxx.
unsigned int TimeDivider::forcePassed | ( | time_t | time, |
unsigned int & | oldinterval | ||
) |
method
time | time |
interval | is interval in which we are now |
Definition at line 47 of file TimeDivider.cxx.
bool TimeDivider::isPassed | ( | time_t | time, |
unsigned int & | newinterval, | ||
unsigned int & | oldinterval | ||
) |
method to know if one shoudl switch to new interval
time | time |
interval | is interval in which we are now |
Definition at line 21 of file TimeDivider.cxx.
|
private |
Definition at line 54 of file TimeDivider.h.
|
private |
Definition at line 53 of file TimeDivider.h.
|
private |
Definition at line 51 of file TimeDivider.h.
|
private |
Definition at line 50 of file TimeDivider.h.
|
private |
Definition at line 52 of file TimeDivider.h.