ARC SDK
|
A class for storing and manipulating times. More...
#include <arc/DateTime.h>
Public Member Functions | |
Time () | |
Default constructor. The time is put equal the current time. | |
Time (time_t) | |
Constructor that takes a time_t variable and stores it. | |
Time (time_t time, uint32_t nanosec) | |
Constructor that takes a fine grained time variables and stores them. | |
Time (const std::string &) | |
Constructor that tries to convert a string into a time_t. | |
Time & | operator= (time_t) |
Assignment operator from a time_t. | |
Time & | operator= (const Time &) |
Assignment operator from a Time. | |
Time & | operator= (const char *) |
Assignment operator from a char pointer. | |
Time & | operator= (const std::string &) |
Assignment operator from a string. | |
void | SetTime (time_t) |
Sets the time. | |
void | SetTime (time_t time, uint32_t nanosec) |
Sets the fine grained time. | |
time_t | GetTime () const |
Gets the time in seconds. | |
time_t | GetTimeNanoseconds () const |
Gets the nanoseconds fraction of the time. | |
operator std::string () const | |
Returns a string representation of the time, using the default format. | |
std::string | str (const TimeFormat &=time_format) const |
Returns a string representation of the time, using the specified format. | |
bool | operator< (const Time &) const |
Comparing two Time objects. | |
bool | operator> (const Time &) const |
Comparing two Time objects. | |
bool | operator<= (const Time &) const |
Comparing two Time objects. | |
bool | operator>= (const Time &) const |
Comparing two Time objects. | |
bool | operator== (const Time &) const |
Comparing two Time objects. | |
bool | operator!= (const Time &) const |
Comparing two Time objects. | |
Time | operator+ (const Period &) const |
Adding Time object with Period object. | |
Time | operator- (const Period &) const |
Subtracting Period object from Time object. | |
Period | operator- (const Time &) const |
Subtracting Time object from the other Time object. | |
Static Public Member Functions | |
static void | SetFormat (const TimeFormat &) |
Sets the default format for time strings. | |
static TimeFormat | GetFormat () |
Gets the default format for time strings. | |
Static Public Attributes | |
static const int | YEAR = 31536000 |
Number of seconds in a year (365 days) | |
static const int | MONTH = 2592000 |
Number of seconds in 30 days. | |
static const int | WEEK = 604800 |
Number of seconds in a week. | |
static const int | DAY = 86400 |
Number of seconds in a day. | |
static const int | HOUR = 3600 |
Number of seconds in an hour. | |
static const time_t | UNDEFINED = (time_t)(-1) |
Undefined time. | |
A class for storing and manipulating times.
Time represents a moment of time (eg midnight on 1st Jan 2000), whereas Period represents a length of time (eg 2 mins and 30.1 seconds).