A timestamp representing a UTC 'point in time' associated with a specific timezone. More...
#include <ZonedTime.h>
Public Member Functions | |
| ZonedTime (time_t utc, const DateTime::ZoneInfo &zoneInfo) | |
| Construct a zoned time. More... | |
| ZonedTime (time_t utc=0) | |
| Construct a time in the UTC zone. More... | |
| ZonedTime (const ZonedTime &other)=default | |
| operator time_t () const | |
| ZonedTime | toUtc () const |
| Get a ZonedTime instance translated into the UTC zone This does nothing more than replace the contained zone information with UTC, which has tag "UTC", no offset and no daylight savings. More... | |
| time_t | local () const |
Obtain the time_t value adjusted for local time. More... | |
| const DateTime::ZoneInfo & | getZoneInfo () const |
| Get instance zone information. More... | |
| const DateTime::ZoneInfo::Tag & | tag () const |
| int16_t | offsetMins () const |
| int | offsetSecs () const |
| bool | isDst () const |
| String | toString () const |
| Obtain default formatted string. More... | |
Format time using <tt>DateTime</tt> | |
| |
| String | format (const char *formatString) const |
| String | format (const String &formatString) const |
| String | toISO8601 () const |
Static Public Member Functions | |
| static void | setDefaultFormat (const String &format) |
| Set the default format for displaying zoned times. More... | |
Detailed Description
A timestamp representing a UTC 'point in time' associated with a specific timezone.
Derivation of the correct DateTime::ZoneInfo value is complex and typically managed by an external library, such as :library:Timezone.
The implicit time_t value for a ZonedTime is the corresponding UTC time. All comparisons or arithmetic operations will therefore operate using this value. This means two ZonedTime objects will be considered equal if their corresponding UTC timestamps match, even if they derive from different timezones.
To obtain the time_t value with local offset applied, use local():
DateTime dtLocal(zonedTime.local());
There is no support in this class for manipulating time or zone information directly. This should be done using the raw time_t value and a new ZonedTime object constructed.
Constructor & Destructor Documentation
◆ ZonedTime() [1/3]
|
inline |
Construct a zoned time.
- Parameters
-
utc zoneInfo
◆ ZonedTime() [2/3]
|
inlineexplicit |
Construct a time in the UTC zone.
◆ ZonedTime() [3/3]
|
default |
Member Function Documentation
◆ format() [1/2]
|
inline |
◆ format() [2/2]
◆ getZoneInfo()
|
inline |
Get instance zone information.
◆ isDst()
|
inline |
◆ local()
|
inline |
Obtain the time_t value adjusted for local time.
◆ offsetMins()
|
inline |
◆ offsetSecs()
|
inline |
◆ operator time_t()
|
inline |
◆ setDefaultFormat()
|
inlinestatic |
Set the default format for displaying zoned times.
◆ tag()
|
inline |
◆ toISO8601()
|
inline |
◆ toString()
|
inline |
Obtain default formatted string.
◆ toUtc()
|
inline |
Get a ZonedTime instance translated into the UTC zone This does nothing more than replace the contained zone information with UTC, which has tag "UTC", no offset and no daylight savings.
The documentation for this class was generated from the following file:
1.9.1