#include <TimeStamp.h>
Public Member Functions | |
std::string | CurrentToString () |
void | getTimeStamp (long &lSeconds, long &lNanoSeconds) |
void | operator+= (double TimeS) |
Increase the timestamp by TimeS seconds. | |
double | operator- (const TimeStamp &EarlierTime) const |
Retrieves time difference in seconds. | |
void | operator-= (double TimeS) |
Reduces the timestamp by TimeS seconds. | |
bool | operator< (const TimeStamp &Time) |
Checks if this time is before time "Time". | |
bool | operator> (const TimeStamp &Time) |
Checks if this time is after time "Time". | |
void | SetNow () |
Makes time measurement. | |
void | setTimeStamp (const long &lSeconds, const long &lNanoSeconds) |
TimeStamp () | |
Constructor. | |
std::string | ToString () |
virtual | ~TimeStamp () |
Destructor. | |
Protected Attributes | |
timespec | m_TimeStamp |
Internal time stamp data. | |
Static Private Member Functions | |
::timespec | DoubleToTimespec (double TimeS) |
Conversion double -> timespec. | |
static double | TimespecToDouble (const ::timespec &LargeInt) |
Conversion timespec -> double. |
Measure system time. Use this class for measure system time accurately. Under Windows, it uses QueryPerformanceCounter(), which has a resolution of approx. one micro-second. The difference between two time stamps can be calculated.
Definition at line 67 of file TimeStamp.h.
TimeStamp::TimeStamp | ( | ) |
Constructor.
Definition at line 58 of file TimeStamp.cpp.
virtual TimeStamp::~TimeStamp | ( | ) | [inline, virtual] |
Destructor.
Definition at line 65 of file TimeStamp.h.
std::string TimeStamp::CurrentToString | ( | ) |
return the current time as string, in long format YYYY-MM-DD HH:MM:SS.ssssss Attention *** call SetNow() before calling this function
Definition at line 158 of file TimeStamp.cpp.
timespec TimeStamp::DoubleToTimespec | ( | double | TimeS | ) | [static, private] |
Conversion double -> timespec.
Definition at line 74 of file TimeStamp.cpp.
void TimeStamp::getTimeStamp | ( | long & | lSeconds, | |
long & | lNanoSeconds | |||
) |
Gets seconds and nanoseconds of the timestamp.
Definition at line 146 of file TimeStamp.cpp.
void TimeStamp::operator+= | ( | double | TimeS | ) |
Increase the timestamp by TimeS seconds.
TimeS | must be >0!. |
Definition at line 106 of file TimeStamp.cpp.
double TimeStamp::operator- | ( | const TimeStamp & | EarlierTime | ) | const |
Retrieves time difference in seconds.
Definition at line 91 of file TimeStamp.cpp.
void TimeStamp::operator-= | ( | double | TimeS | ) |
Reduces the timestamp by TimeS seconds.
TimeS | must be >0!. |
Definition at line 118 of file TimeStamp.cpp.
bool TimeStamp::operator< | ( | const TimeStamp & | Time | ) |
Checks if this time is before time "Time".
Definition at line 138 of file TimeStamp.cpp.
bool TimeStamp::operator> | ( | const TimeStamp & | Time | ) |
Checks if this time is after time "Time".
Definition at line 130 of file TimeStamp.cpp.
void TimeStamp::SetNow | ( | ) |
Makes time measurement.
Definition at line 64 of file TimeStamp.cpp.
void TimeStamp::setTimeStamp | ( | const long & | lSeconds, | |
const long & | lNanoSeconds | |||
) |
Sets timestamp from seconds and nanoseconds.
Definition at line 152 of file TimeStamp.cpp.
double TimeStamp::TimespecToDouble | ( | const ::timespec & | LargeInt | ) | [static, private] |
Conversion timespec -> double.
Definition at line 69 of file TimeStamp.cpp.
std::string TimeStamp::ToString | ( | ) |
Definition at line 178 of file TimeStamp.cpp.
timespec TimeStamp::m_TimeStamp [protected] |
Internal time stamp data.
Definition at line 110 of file TimeStamp.h.