DUtils::Timestamp Class Reference
Timestamp.
More...
#include <Timestamp.h>
List of all members.
Detailed Description
Timestamp.
Constructor & Destructor Documentation
Creates a timestamp
- Parameters:
-
| option | option to set the initial time stamp |
Timestamp::~Timestamp |
( |
void |
|
) |
[virtual] |
Member Function Documentation
bool Timestamp::empty |
( |
|
) |
const |
Says if the timestamp is "empty": seconds and usecs are both 0, as when initiated with the ZERO flag
- Returns:
- true iif secs == usecs == 0
string Timestamp::Format |
( |
double |
s |
) |
[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
- Parameters:
-
| s,: | elapsed seconds (given by getFloatTime) to format |
string Timestamp::Format |
( |
bool |
machine_friendly = false |
) |
const |
Returns the timestamp in a human-readable string
- Parameters:
-
| machine_friendly | if true, the returned string is formatted to yyyymmdd_hhmmss, without weekday or spaces |
- Note:
- This has not been tested under Windows
-
The timestamp is truncated to seconds
double Timestamp::getFloatTime |
( |
|
) |
const |
Returns this timestamp as the number of seconds in (long) float format
string Timestamp::getStringTime |
( |
|
) |
const |
Returns this timestamp as the number of seconds in fixed length string format
void DUtils::Timestamp::getTime |
( |
unsigned long & |
secs, |
|
|
unsigned long & |
usecs | |
|
) |
| | const [inline] |
Returns the timestamp in seconds and microseconds
- Parameters:
-
| secs | seconds |
| usecs | microseconds |
Timestamp Timestamp::minus |
( |
unsigned long |
s, |
|
|
unsigned long |
us | |
|
) |
| | const |
Returns a copy of this timestamp - s seconds - us microseconds
- Parameters:
-
| s | seconds |
| us | microseconds |
Timestamp Timestamp::operator+ |
( |
double |
s |
) |
const |
Returns a copy of this timestamp + s seconds
- Parameters:
-
Timestamp & Timestamp::operator+= |
( |
double |
s |
) |
|
Adds s seconds to this timestamp and returns a reference to itself
- Parameters:
-
- Returns:
- reference to this timestamp
Timestamp Timestamp::operator- |
( |
double |
s |
) |
const |
Returns a copy of this timestamp - s seconds
- Parameters:
-
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
- Parameters:
-
| t,: | timestamp to subtract from this timestamp |
- Returns:
- difference in seconds
Timestamp & Timestamp::operator-= |
( |
double |
s |
) |
|
Substracts s seconds to this timestamp and returns a reference to itself
- Parameters:
-
- Returns:
- reference to this timestamp
bool Timestamp::operator< |
( |
const Timestamp & |
t |
) |
const |
Returns whether this timestamp is at the past of t
- Parameters:
-
bool Timestamp::operator<= |
( |
const Timestamp & |
t |
) |
const |
Returns whether this timestamp is at the past of (or is the same as) t
- Parameters:
-
bool Timestamp::operator== |
( |
const Timestamp & |
t |
) |
const |
Returns whether this timestamp and t represent the same instant
- Parameters:
-
bool Timestamp::operator> |
( |
const Timestamp & |
t |
) |
const |
Returns whether this timestamp is at the future of t
- Parameters:
-
bool Timestamp::operator>= |
( |
const Timestamp & |
t |
) |
const |
Returns whether this timestamp is at the future of (or is the same as) t
- Parameters:
-
Timestamp Timestamp::plus |
( |
unsigned long |
s, |
|
|
unsigned long |
us | |
|
) |
| | const |
Returns a copy of this timestamp + s seconds + us microseconds
- Parameters:
-
| s | seconds |
| us | microseconds |
void Timestamp::setTime |
( |
double |
s |
) |
|
Sets the timestamp from a number of seconds from the epoch
- Parameters:
-
void Timestamp::setTime |
( |
const string & |
stime |
) |
|
Sets the timestamp from a string with the time in seconds
- Parameters:
-
| stime,: | string such as "1235603336.036609" |
void DUtils::Timestamp::setTime |
( |
unsigned long |
secs, |
|
|
unsigned long |
usecs | |
|
) |
| | [inline] |
Sets the timestamp from seconds and microseconds
- Parameters:
-
| secs,: | seconds |
| usecs,: | microseconds |
void Timestamp::setToCurrentTime |
( |
|
) |
|
Sets this instance to the current time
The documentation for this class was generated from the following files: