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. More... | |
Time (time_t) | |
Constructor that takes a time_t variable and stores it. More... | |
Time (time_t time, uint32_t nanosec) | |
Constructor that takes a fine grained time variables and stores them. More... | |
Time (const std::string &) | |
Constructor that tries to convert a string into a time_t. More... | |
Time & | operator= (time_t) |
Assignment operator from a time_t. More... | |
Time & | operator= (const Time &) |
Assignment operator from a Time. More... | |
Time & | operator= (const char *) |
Assignment operator from a char pointer. More... | |
Time & | operator= (const std::string &) |
Assignment operator from a string. More... | |
void | SetTime (time_t) |
Sets the time. More... | |
void | SetTime (time_t time, uint32_t nanosec) |
Sets the fine grained time. More... | |
time_t | GetTime () const |
Gets the time in seconds. More... | |
uint32_t | GetTimeNanoseconds () const |
Gets the nanoseconds fraction of the time. More... | |
operator std::string () const | |
Returns a string representation of the time, using the default format. More... | |
std::string | str (const TimeFormat &=time_format) const |
Returns a string representation of the time, using the specified format. More... | |
bool | operator< (const Time &) const |
Comparing two Time objects. More... | |
bool | operator> (const Time &) const |
Comparing two Time objects. More... | |
bool | operator<= (const Time &) const |
Comparing two Time objects. More... | |
bool | operator>= (const Time &) const |
Comparing two Time objects. More... | |
bool | operator== (const Time &) const |
Comparing two Time objects. More... | |
bool | operator!= (const Time &) const |
Comparing two Time objects. More... | |
Time | operator+ (const Period &) const |
Adding Time object with Period object. More... | |
Time | operator- (const Period &) const |
Subtracting Period object from Time object. More... | |
Period | operator- (const Time &) const |
Subtracting Time object from the other Time object. More... | |
Static Public Member Functions | |
static void | SetFormat (const TimeFormat &) |
Sets the default format for time strings. More... | |
static TimeFormat | GetFormat () |
Gets the default format for time strings. More... | |
Static Public Attributes | |
static const int | YEAR = 31536000 |
Number of seconds in a year (365 days) More... | |
static const int | MONTH = 2592000 |
Number of seconds in 30 days. More... | |
static const int | WEEK = 604800 |
Number of seconds in a week. More... | |
static const int | DAY = 86400 |
Number of seconds in a day. More... | |
static const int | HOUR = 3600 |
Number of seconds in an hour. More... | |
static const time_t | UNDEFINED = (time_t)(-1) |
Undefined time. More... | |
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).
Arc::Time::Time | ( | ) |
Default constructor. The time is put equal the current time.
Arc::Time::Time | ( | time_t | ) |
Constructor that takes a time_t variable and stores it.
Arc::Time::Time | ( | time_t | time, |
uint32_t | nanosec | ||
) |
Constructor that takes a fine grained time variables and stores them.
Arc::Time::Time | ( | const std::string & | ) |
Constructor that tries to convert a string into a time_t.
|
static |
Gets the default format for time strings.
time_t Arc::Time::GetTime | ( | ) | const |
Gets the time in seconds.
uint32_t Arc::Time::GetTimeNanoseconds | ( | ) | const |
Gets the nanoseconds fraction of the time.
Arc::Time::operator std::string | ( | ) | const |
Returns a string representation of the time, using the default format.
Time& Arc::Time::operator= | ( | time_t | ) |
Assignment operator from a time_t.
Assignment operator from a Time.
Time& Arc::Time::operator= | ( | const char * | ) |
Assignment operator from a char pointer.
Time& Arc::Time::operator= | ( | const std::string & | ) |
Assignment operator from a string.
|
static |
Sets the default format for time strings.
void Arc::Time::SetTime | ( | time_t | ) |
Sets the time.
void Arc::Time::SetTime | ( | time_t | time, |
uint32_t | nanosec | ||
) |
Sets the fine grained time.
std::string Arc::Time::str | ( | const TimeFormat & | = time_format | ) | const |
Returns a string representation of the time, using the specified format.
|
static |
Number of seconds in a day.
|
static |
Number of seconds in an hour.
|
static |
Number of seconds in 30 days.
|
static |
Undefined time.
|
static |
Number of seconds in a week.
|
static |
Number of seconds in a year (365 days)