BitmapToolkit Scol plugin
|
#include <Timestamp.h>
Public Types | |
enum | tOptions { NONE = 0 , CURRENT_TIME = 0x1 , ZERO = 0x2 } |
Options to initiate a timestamp. More... | |
Public Member Functions | |
Timestamp (Timestamp::tOptions option=NONE) | |
virtual | ~Timestamp (void) |
bool | empty () const |
void | setToCurrentTime () |
void | setTime (unsigned long secs, unsigned long usecs) |
void | getTime (unsigned long &secs, unsigned long &usecs) const |
void | setTime (const string &stime) |
void | setTime (double s) |
double | getFloatTime () const |
string | getStringTime () const |
double | operator- (const Timestamp &t) const |
Timestamp | plus (unsigned long s, unsigned long us) const |
Timestamp | minus (unsigned long s, unsigned long us) const |
Timestamp & | operator+= (double s) |
Timestamp & | operator-= (double s) |
Timestamp | operator+ (double s) const |
Timestamp | operator- (double s) const |
bool | operator> (const Timestamp &t) const |
bool | operator>= (const Timestamp &t) const |
bool | operator== (const Timestamp &t) const |
bool | operator< (const Timestamp &t) const |
bool | operator<= (const Timestamp &t) const |
string | Format (bool machine_friendly=false) const |
Static Public Member Functions | |
static string | Format (double s) |
Protected Attributes | |
unsigned long | m_secs |
Seconds. | |
unsigned long | m_usecs |
Microseconds. | |
Definition at line 19 of file Timestamp.h.
Options to initiate a timestamp.
Enumerator | |
---|---|
NONE | |
CURRENT_TIME | |
ZERO |
Definition at line 24 of file Timestamp.h.
Timestamp::Timestamp | ( | Timestamp::tOptions | option = NONE | ) |
Creates a timestamp
option | option to set the initial time stamp |
Definition at line 39 of file Timestamp.cpp.
|
virtual |
Destructor
Definition at line 47 of file Timestamp.cpp.
bool Timestamp::empty | ( | ) | const |
Says if the timestamp is "empty": seconds and usecs are both 0, as when initiated with the ZERO flag
Definition at line 51 of file Timestamp.cpp.
string Timestamp::Format | ( | bool | machine_friendly = false | ) | const |
Returns the timestamp in a human-readable string
machine_friendly | if true, the returned string is formatted to yyyymmdd_hhmmss, without weekday or spaces |
Definition at line 198 of file Timestamp.cpp.
|
static |
Returns a string version of the elapsed time in seconds, with the format xd hh:mm:ss, hh:mm:ss, mm:ss or s.us
s | elapsed seconds (given by getFloatTime) to format |
Definition at line 224 of file Timestamp.cpp.
double Timestamp::getFloatTime | ( | ) | const |
Returns this timestamp as the number of seconds in (long) float format
Definition at line 94 of file Timestamp.cpp.
string Timestamp::getStringTime | ( | ) | const |
Returns this timestamp as the number of seconds in fixed length string format
Definition at line 98 of file Timestamp.cpp.
|
inline |
Returns the timestamp in seconds and microseconds
secs | seconds |
usecs | microseconds |
Definition at line 71 of file Timestamp.h.
Timestamp Timestamp::minus | ( | unsigned long | s, |
unsigned long | us | ||
) | const |
Returns a copy of this timestamp - s seconds - us microseconds
s | seconds |
us | microseconds |
Definition at line 150 of file Timestamp.cpp.
Timestamp Timestamp::operator+ | ( | double | s | ) | const |
Returns a copy of this timestamp + s seconds
s | seconds |
Definition at line 120 of file Timestamp.cpp.
Timestamp & Timestamp::operator+= | ( | double | s | ) |
Adds s seconds to this timestamp and returns a reference to itself
s | seconds |
Definition at line 108 of file Timestamp.cpp.
double Timestamp::operator- | ( | const Timestamp & | t | ) | const |
Returns the difference in seconds between this timestamp (greater) and t (smaller) If the order is swapped, a negative number is returned
t | timestamp to subtract from this timestamp |
Definition at line 104 of file Timestamp.cpp.
Timestamp Timestamp::operator- | ( | double | s | ) | const |
Returns a copy of this timestamp - s seconds
s | seconds |
Definition at line 142 of file Timestamp.cpp.
Timestamp & Timestamp::operator-= | ( | double | s | ) |
Substracts s seconds to this timestamp and returns a reference to itself
s | seconds |
Definition at line 114 of file Timestamp.cpp.
bool Timestamp::operator< | ( | const Timestamp & | t | ) | const |
Returns whether this timestamp is at the past of t
t |
Definition at line 178 of file Timestamp.cpp.
bool Timestamp::operator<= | ( | const Timestamp & | t | ) | const |
Returns whether this timestamp is at the past of (or is the same as) t
t |
Definition at line 185 of file Timestamp.cpp.
bool Timestamp::operator== | ( | const Timestamp & | t | ) | const |
Returns whether this timestamp and t represent the same instant
t |
Definition at line 192 of file Timestamp.cpp.
bool Timestamp::operator> | ( | const Timestamp & | t | ) | const |
Returns whether this timestamp is at the future of t
t |
Definition at line 164 of file Timestamp.cpp.
bool Timestamp::operator>= | ( | const Timestamp & | t | ) | const |
Returns whether this timestamp is at the future of (or is the same as) t
t |
Definition at line 171 of file Timestamp.cpp.
Timestamp Timestamp::plus | ( | unsigned long | s, |
unsigned long | us | ||
) | const |
Returns a copy of this timestamp + s seconds + us microseconds
s | seconds |
us | microseconds |
Definition at line 128 of file Timestamp.cpp.
void Timestamp::setTime | ( | const string & | stime | ) |
Sets the timestamp from a string with the time in seconds
stime | string such as "1235603336.036609" |
Definition at line 73 of file Timestamp.cpp.
void Timestamp::setTime | ( | double | s | ) |
Sets the timestamp from a number of seconds from the epoch
s | seconds from the epoch |
Definition at line 88 of file Timestamp.cpp.
|
inline |
Sets the timestamp from seconds and microseconds
secs | seconds |
usecs | microseconds |
Definition at line 61 of file Timestamp.h.
void Timestamp::setToCurrentTime | ( | ) |
Sets this instance to the current time
Definition at line 56 of file Timestamp.cpp.
|
protected |
Seconds.
Definition at line 196 of file Timestamp.h.
|
protected |
Microseconds.
Definition at line 198 of file Timestamp.h.