Class or struct representing an exact point in time. More...
Public Member Functions | |
| time_t | get_time_t () const |
| Convert a Timestamp to a "time_t" (from C's time library). More... | |
| struct tm | get_struct_tm (const TimeDelta &time_zone_offset) const |
| Convert a Timestamp to a "struct tm" (from C's time library) in a certain time zone (represented by an offset from UTC). More... | |
| struct tm | get_struct_tm_utc () const |
| Convert a Timestamp to a "struct tm" (from C's time library) in Coordinated Universal Time. More... | |
| struct tm | get_struct_tm_local () const |
| Convert a Timestamp to a "struct tm" (from C's time library) in the system's current local time zone. More... | |
| Date | get_date (const TimeDelta &time_zone_offset) const |
| Get the Date component of a Timestamp in a certain time zone (represented by an offset from UTC). More... | |
| Date | get_date_utc () const |
| Get the Date component of a Timestamp in Coordinated Universal Time. More... | |
| Date | get_date_local () const |
| Get the Date component of a Timestamp in the system's current local time zone. More... | |
| ClockTime | get_clock_time (const TimeDelta &time_zone_offset) const |
| Get the ClockTime component of a Timestamp in a certain time zone (represented by an offset from UTC). More... | |
| ClockTime | get_clock_time_utc () const |
| Get the ClockTime component of a Timestamp in Coordinated Universal Time. More... | |
| ClockTime | get_clock_time_local () const |
| Get the ClockTime component of a Timestamp in the system's current local time zone. More... | |
| TimeDelta | difference (const Timestamp &other) const |
| Get the difference between two Timestamp instances as a TimeDelta. More... | |
| TimeDelta | absolute_difference (const Timestamp &other) const |
| Get the absolute difference between two Timestamp instances as a TimeDelta. More... | |
| Timestamp & | operator+= (const TimeDelta &delta) |
| Add a TimeDelta to a Timestamp. More... | |
| Timestamp & | operator+= (const DayDelta &delta) |
| Add a DayDelta to a Timestamp. More... | |
| Timestamp & | operator+= (const MonthDelta &delta) |
| Add a MonthDelta to a Timestamp. More... | |
| Timestamp & | operator-= (const TimeDelta &delta) |
| Subtract a TimeDelta from a Timestamp. More... | |
| Timestamp & | operator-= (const DayDelta &delta) |
| Subtract a DayDelta from a Timestamp. More... | |
| Timestamp & | operator-= (const MonthDelta &delta) |
| Subtract a MonthDelta from a Timestamp. More... | |
Static Public Member Functions | |
| static Timestamp | create (const time_t time) |
| Create a new Timestamp based on a "time_t" value (from C's time library). More... | |
| static Timestamp | create (const struct tm &tm, const TimeDelta &time_zone_offset) |
| Create a new Timestamp based on a "struct tm" value (from C's time library) in a certain time zone. More... | |
| static Timestamp | create_utc (const struct tm &tm) |
| Create a new Timestamp based on a "struct tm" value (from C's time library) in Coordinated Universal Time. More... | |
| static Timestamp | create_local (const struct tm &tm) |
| Create a new Timestamp based on a "struct tm" value (from C's time library) in the system's current local time zone. More... | |
| static Timestamp | create (const Date &date, const ClockTime &clock_time, const TimeDelta &time_zone_offset) |
| Create a new Timestamp based on a Date and ClockTime in a certain time zone. More... | |
| static Timestamp | create_utc (const Date &date, const ClockTime &clock_time) |
| Create a new Timestamp based on a Date and ClockTime in Coordinated Universal Time. More... | |
| static Timestamp | create_local (const Date &date, const ClockTime &clock_time) |
| Create a new Timestamp based on a Date and ClockTime in the system's current local time zone. More... | |
| static Timestamp | now () |
| Create a new Timestamp representing the exact time right now. More... | |
| static Timestamp | epoch () |
| Create a new Timestamp representing the UNIX epoch (Jan. More... | |
| static short | compare (const Timestamp &lhs, const Timestamp &rhs) |
| Compare two Timestamp instances. More... | |
Public Attributes | |
| present_bool | has_error |
| This will be true if there were any errors when creating this Timestamp. More... | |
| struct { | |
| unsigned int invalid_clock_time: 1 | |
| unsigned int invalid_date: 1 | |
| } | errors |
| If there were any errors when creating this Timestamp, then one or more of these fields will be set. More... | |
| struct PresentTimestampData | data_ |
Friends | |
| const Timestamp | operator+ (const Timestamp &lhs, const TimeDelta &rhs) |
| const Timestamp | operator+ (const TimeDelta &lhs, const Timestamp &rhs) |
| const Timestamp | operator+ (const Timestamp &lhs, const DayDelta &rhs) |
| const Timestamp | operator+ (const DayDelta &lhs, const Timestamp &rhs) |
| const Timestamp | operator+ (const Timestamp &lhs, const MonthDelta &rhs) |
| const Timestamp | operator+ (const MonthDelta &lhs, const Timestamp &rhs) |
| const Timestamp | operator- (const Timestamp &lhs, const TimeDelta &rhs) |
| const Timestamp | operator- (const Timestamp &lhs, const DayDelta &rhs) |
| const Timestamp | operator- (const Timestamp &lhs, const MonthDelta &rhs) |
| bool | operator== (const Timestamp &lhs, const Timestamp &rhs) |
| Determine whether two Timestamp instances represent the exact same point in time (lhs == rhs). More... | |
| bool | operator!= (const Timestamp &lhs, const Timestamp &rhs) |
| bool | operator< (const Timestamp &lhs, const Timestamp &rhs) |
| Determine whether a Timestamp occurs earlier than another Timestamp (lhs < rhs). More... | |
| bool | operator<= (const Timestamp &lhs, const Timestamp &rhs) |
| Determine whether a Timestamp occurs earlier than or at the same time as another Timestamp (lhs <= rhs). More... | |
| bool | operator> (const Timestamp &lhs, const Timestamp &rhs) |
| Determine whether a Timestamp occurs later than another Timestamp (lhs > rhs). More... | |
| bool | operator>= (const Timestamp &lhs, const Timestamp &rhs) |
| Determine whether a Timestamp occurs later than or at the same time as another Timestamp (lhs >= rhs). More... | |
Class or struct representing an exact point in time.
This includes a full date and time, and is sensitive to time zones.
|
static |
Create a new Timestamp based on a "time_t" value (from C's time library).
| time | The "time_t" value representing the timestamp. |
|
static |
Create a new Timestamp based on a "struct tm" value (from C's time library) in a certain time zone.
| tm | The "struct tm" value representing the date and time. |
| time_zone_offset | The time zone offset (from UTC) used to interpret tm. |
|
static |
Create a new Timestamp based on a "struct tm" value (from C's time library) in Coordinated Universal Time.
| tm | The "struct tm" value representing the date and time. |
|
static |
Create a new Timestamp based on a "struct tm" value (from C's time library) in the system's current local time zone.
| tm | The "struct tm" value representing the date and time. |
|
static |
Create a new Timestamp based on a Date and ClockTime in a certain time zone.
Future modifications to the original Date and ClockTime do NOT affect the new Timestamp.
If the Date or ClockTime is invalid, the Timestamp will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
Create a new Timestamp based on a Date and ClockTime in Coordinated Universal Time.
Future modifications to the original Date and ClockTime do NOT affect the new Timestamp.
If the Date or ClockTime is invalid, the Timestamp will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
Create a new Timestamp based on a Date and ClockTime in the system's current local time zone.
Future modifications to the original Date and ClockTime do NOT affect the new Timestamp.
If the Date or ClockTime is invalid, the Timestamp will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
|
static |
|
static |
Create a new Timestamp representing the UNIX epoch (Jan.
1, 1970 00:00:00 UTC).
| time_t Timestamp::get_time_t | ( | ) | const |
Convert a Timestamp to a "time_t" (from C's time library).
| struct tm Timestamp::get_struct_tm | ( | const TimeDelta & | time_zone_offset | ) | const |
Convert a Timestamp to a "struct tm" (from C's time library) in a certain time zone (represented by an offset from UTC).
| struct tm Timestamp::get_struct_tm_utc | ( | ) | const |
Convert a Timestamp to a "struct tm" (from C's time library) in Coordinated Universal Time.
| struct tm Timestamp::get_struct_tm_local | ( | ) | const |
Convert a Timestamp to a "struct tm" (from C's time library) in the system's current local time zone.
| Date Timestamp::get_date_utc | ( | ) | const |
| Date Timestamp::get_date_local | ( | ) | const |
| ClockTime Timestamp::get_clock_time_utc | ( | ) | const |
| ClockTime Timestamp::get_clock_time_local | ( | ) | const |
| Timestamp& Timestamp::operator+= | ( | const MonthDelta & | delta | ) |
Add a MonthDelta to a Timestamp.
| Timestamp& Timestamp::operator-= | ( | const MonthDelta & | delta | ) |
Subtract a MonthDelta from a Timestamp.
Compare two Timestamp instances.
|
friend |
|
friend |
|
friend |
Determine whether two Timestamp instances represent the exact same point in time (lhs == rhs).
| present_bool Timestamp::has_error |
This will be true if there were any errors when creating this Timestamp.
For more details about the errors that occurred, see errors. For more details about the errors that occurred, see errors.
This field should be treated as read-only; DO NOT modify its contents!
| unsigned int Timestamp::invalid_clock_time |
| unsigned int Timestamp::invalid_date |
| struct { ... } Timestamp::errors |
If there were any errors when creating this Timestamp, then one or more of these fields will be set.
To quickly check if any error occurred, see has_error. To quickly check if any error occurred, see has_error.
These fields should be treated as read-only; DO NOT modify their contents!
| struct PresentTimestampData Timestamp::data_ |