24 #ifndef PPL_Time_inlines_hh
25 #define PPL_Time_inlines_hh 1
31 namespace Implementation {
37 : secs(0), microsecs(0) {
43 : secs(centisecs / CSECS_PER_SEC),
44 microsecs((centisecs % CSECS_PER_SEC) * (USECS_PER_SEC/CSECS_PER_SEC)) {
87 if (r_microsecs < 0) {
117 assert(x.
OK() && y.
OK());
123 assert(x.
OK() && y.
OK());
129 assert(x.
OK() && y.
OK());
136 return x < y || x == y;
155 #endif // !defined(PPL_Time_inlines_hh)
long microseconds() const
Returns the number of microseconds that, when added to the number of seconds returned by seconds()...
static const long USECS_PER_SEC
Number of microseconds in a second.
Time & operator+=(const Time &y)
Adds y to *this.
Time operator+(const Time &x, const Time &y)
Returns the sum of x and y.
bool operator<(const Time &x, const Time &y)
Returns true if and only if x is shorter than y.
Time operator-(const Time &x, const Time &y)
Returns the difference of x and y or the null interval, if x is shorter than y.
A class for representing and manipulating positive time intervals.
bool operator==(const Time &x, const Time &y)
Returns true if and only if x and y are equal.
Time & operator-=(const Time &y)
Subtracts y from *this; if *this is shorter than y, *this is set to the null interval.
The entire library is confined to this namespace.
long secs
Number of seconds.
bool operator>(const Time &x, const Time &y)
Returns true if and only if x is longer than y.
long microsecs
Number of microseconds.
bool operator!=(const Time &x, const Time &y)
Returns true if and only if x and y are different.
bool operator>=(const Time &x, const Time &y)
Returns true if and only if x is longer than or equal to y.
long seconds() const
Returns the number of whole seconds contained in the represented time interval.
bool OK() const
Checks if all the invariants are satisfied.
bool operator<=(const Time &x, const Time &y)
Returns true if and only if x is shorter than or equal to y.