|
Google APIs Client Library for C++
|
Represents a date convertable among various standard date represenations including RFC 3339 used by JSON encodings. More...
#include "client/util/date_time.h"
Public Member Functions | |
| DateTime () | |
| Construct a date with the current time. | |
| DateTime (const string &date) | |
| Construct a date from an RFC 3339 formatted string. | |
| DateTime (time_t time) | |
| Construct a date from an epoch time. | |
| DateTime (const struct timeval &time) | |
| Construct a date from a timeval. | |
| DateTime (const DateTime &date) | |
| Copy constructor. | |
| ~DateTime () | |
| Standard destructor. | |
| string | ToString () const |
| Convert the data to an RFC 3330 encoded string. | |
| void | GetLocalTime (struct tm *out) const |
| Convert the date to local time. | |
| void | GetUniversalTime (struct tm *out) const |
| Convert the date to universal time. | |
| void | GetTimeval (struct timeval *timeval) const |
| time_t | ToEpochTime () const |
| Convert the date to epoch time. | |
| bool | is_valid () const |
| Determine if we have a valid date or not. | |
| int | Compare (const DateTime &date) const |
| Determine relative ordering of this date relative to another. | |
| bool | operator== (const DateTime &date) const |
| Determine if this date is equal to another. | |
| bool | operator< (const DateTime &date) const |
| Determine if this date is earlier than another. | |
| bool | operator> (const DateTime &date) const |
| Determine if this date is later than another. | |
| bool | operator!= (const DateTime &date) const |
| Determine if this date is different from another. | |
| bool | operator<= (const DateTime &date) const |
| Determine if this earlier or equal to another. | |
| bool | operator>= (const DateTime &date) const |
| Determine if this later or equal to another. | |
| DateTime & | operator= (const DateTime &date) |
| Reasign this date to another. | |
Static Public Member Functions | |
| static DateTime | DateTimeFromUtc (const struct tm &utc) |
| Construct a date from a UTC struct tm. | |
| static DateTime | DateTimeFromLocal (const struct tm &local) |
| Construct a date from a local-time struct tm. | |
Protected Member Functions | |
| void | MarkInvalid () |
| Marks this date as being invalid. | |
| DateTime (const struct tm &local) | |
| Construct the data from a struct tm that is in local time. | |
Protected Attributes | |
| struct timeval | t_ |
Static Protected Attributes | |
| static const time_t | kInvalidEpoch_ |
Represents a date convertable among various standard date represenations including RFC 3339 used by JSON encodings.
| DateTime | ( | ) |
Construct a date with the current time.
| DateTime | ( | const string & | date | ) | [explicit] |
Construct a date from an RFC 3339 formatted string.
| DateTime | ( | time_t | time | ) | [explicit] |
Construct a date from an epoch time.
| DateTime | ( | const struct timeval & | time | ) | [explicit] |
Construct a date from a timeval.
| [in] | time | Can contain fractional seconds. |
| ~DateTime | ( | ) |
Standard destructor.
| DateTime | ( | const struct tm & | local | ) | [explicit, protected] |
Construct the data from a struct tm that is in local time.
This constructir is exposed through the public factory methods the struct tm is in.
Determine relative ordering of this date relative to another.
| [in] | date | The date to compare against |
| static DateTime DateTimeFromLocal | ( | const struct tm & | local | ) | [inline, static] |
Construct a date from a local-time struct tm.
| static DateTime DateTimeFromUtc | ( | const struct tm & | utc | ) | [static] |
Construct a date from a UTC struct tm.
| void GetLocalTime | ( | struct tm * | out | ) | const [inline] |
Convert the date to local time.
| void GetTimeval | ( | struct timeval * | timeval | ) | const [inline] |
| void GetUniversalTime | ( | struct tm * | out | ) | const [inline] |
Convert the date to universal time.
| bool is_valid | ( | ) | const [inline] |
Determine if we have a valid date or not.
| void MarkInvalid | ( | ) | [protected] |
Marks this date as being invalid.
| bool operator!= | ( | const DateTime & | date | ) | const [inline] |
Determine if this date is different from another.
| bool operator< | ( | const DateTime & | date | ) | const [inline] |
Determine if this date is earlier than another.
| bool operator<= | ( | const DateTime & | date | ) | const [inline] |
Determine if this earlier or equal to another.
| bool operator== | ( | const DateTime & | date | ) | const [inline] |
Determine if this date is equal to another.
| bool operator> | ( | const DateTime & | date | ) | const [inline] |
Determine if this date is later than another.
| bool operator>= | ( | const DateTime & | date | ) | const [inline] |
Determine if this later or equal to another.
| time_t ToEpochTime | ( | ) | const [inline] |
Convert the date to epoch time.
| string ToString | ( | ) | const |
Convert the data to an RFC 3330 encoded string.
const time_t kInvalidEpoch_ [static, protected] |
struct timeval t_ [protected] |