wfmath
1.0.3
A math library for the Worldforge system.
|
The difference between two timestamps. More...
#include <timestamp.h>
Public Member Functions | |
TimeDiff () | |
construct an uninitialized TimeDiff More... | |
TimeDiff (long msec) | |
construct a TimeDiff of a given number of milliseconds More... | |
long | milliseconds () const |
Get the value of a TimeDiff in milliseconds. More... | |
std::pair< long, long > | full_time () const |
Get the value of a TimeDiff in (seconds, microseconds) More... | |
bool | isValid () const |
TimeDiff | operator- () const |
negate a TimeDiff More... | |
Friends | |
TimeDiff & | operator+= (TimeDiff &, const TimeDiff &) |
increment a TimeDiff More... | |
TimeDiff & | operator-= (TimeDiff &, const TimeDiff &) |
decrement a TimeDiff More... | |
TimeDiff | operator+ (const TimeDiff &a, const TimeDiff &b) |
add two TimeDiff instances More... | |
TimeDiff | operator- (const TimeDiff &a, const TimeDiff &b) |
subtract two TimeDiff instances More... | |
TimeStamp & | operator+= (TimeStamp &, const TimeDiff &) |
advance a TimeStamp by a TimeDiff More... | |
TimeStamp & | operator-= (TimeStamp &, const TimeDiff &) |
regress a TimeStamp by a TimeDiff More... | |
TimeStamp | operator+ (const TimeStamp &a, const TimeDiff &msec) |
find the result of advancing a TimeStamp More... | |
TimeStamp | operator- (const TimeStamp &a, const TimeDiff &msec) |
find the result of regressing a TimeStamp More... | |
TimeDiff | operator- (const TimeStamp &a, const TimeStamp &b) |
find the time difference between two time stamps More... | |
bool | operator< (const TimeDiff &, const TimeDiff &) |
bool | operator== (const TimeDiff &, const TimeDiff &) |
The difference between two timestamps.
This class implements the 'generic' subset of the interface in the fake class Shape, with the exception of the stream operators. It also has the full set of comparison * operators (<, <=, >, >=, ==, !=).
Definition at line 52 of file timestamp.h.
|
inline |
construct an uninitialized TimeDiff
Definition at line 57 of file timestamp.h.
Referenced by operator-().
WFMath::TimeDiff::TimeDiff | ( | long | msec | ) |
construct a TimeDiff of a given number of milliseconds
Definition at line 69 of file timestamp.cpp.
|
inline |
Get the value of a TimeDiff in (seconds, microseconds)
Definition at line 69 of file timestamp.h.
long WFMath::TimeDiff::milliseconds | ( | ) | const |
Get the value of a TimeDiff in milliseconds.
WARNING! This function does not check for overflow, if the number of milliseconds is large
Definition at line 81 of file timestamp.cpp.
|
inline |
add two TimeDiff instances
Definition at line 110 of file timestamp.cpp.
find the result of advancing a TimeStamp
Definition at line 212 of file timestamp.cpp.
increment a TimeDiff
Definition at line 86 of file timestamp.cpp.
advance a TimeStamp by a TimeDiff
Definition at line 190 of file timestamp.cpp.
subtract two TimeDiff instances
Definition at line 115 of file timestamp.cpp.
find the result of regressing a TimeStamp
Definition at line 218 of file timestamp.cpp.
find the time difference between two time stamps
Definition at line 224 of file timestamp.cpp.
decrement a TimeDiff
Definition at line 98 of file timestamp.cpp.
regress a TimeStamp by a TimeDiff
Definition at line 201 of file timestamp.cpp.