The absl::TimeZone is an opaque, small, value‐type class representing a geo‐political region within which particular rules are used for converting between absolute and civil times (see https://git.io/v59Ly). absl::TimeZone values are named using the TZ identifiers from the IANA Time Zone Database, such as "America/Los_Angeles" or "Australia/Sydney". absl::TimeZone values are created from factory functions such as absl::LoadTimeZone(). Note: strings like "PST" and "EDT" are not valid TZ identifiers. Prefer to pass by value rather than const reference.
Synopsis
Declared in <absl/time/time.h>
class TimeZone;
Description
For more on the fundamental concepts of time zones, absolute times, and civil times, see https://github.com/google/cctz#fundamental‐concepts
Examples:
absl::TimeZone utc = absl::UTCTimeZone(); absl::TimeZone pst = absl::FixedTimeZone(‐8 * 60 * 60); absl::TimeZone loc = absl::LocalTimeZone(); absl::TimeZone lax; if (!absl::LoadTimeZone("America/Los_Angeles", &lax)) { // handle error case }
See also:
-
https://github.com/google/cctz
-
https://www.iana.org/time‐zones
-
https://en.wikipedia.org/wiki/Zoneinfo
Types
Name |
Description |
Information about the civil time corresponding to an absolute time. This struct is not intended to represent an instant in time. So, rather than passing a |
|
A transition in a time zone: the civil times just before and after an offset change. |
|
Information about the absolute times corresponding to a civil time. (Subseconds must be handled separately.) |
Member Functions
Name |
Description |
|
Constructors |
Assigns a copy of another time zone. |
|
|
|
Finds the next offset change in this time zone at or after a given time. |
|
Finds the previous offset change in this time zone before a given time. |
|
Returns the TZ identifier name of this time zone. |
|
|
Converts this time zone to the underlying cctz time zone. |
Friends
Name |
Description |
Writes the time zone's name to an output stream. |
|
Returns whether two time zones are unequal. |
|
Returns whether two time zones are equal. |
|
Combines this time zone into a hash state. |
Non-Member Functions
Name |
Description |
Returns a TimeZone that is a fixed offset (seconds east) from UTC. Note: If the absolute value of the offset is greater than 24 hours you'll get UTC (i.e., no offset) instead. |
|
Convenience method returning the local time zone, or UTC if there is no configured local zone. Warning: Be wary of using LocalTimeZone(), and particularly so in a server process, as the zone configured for the local machine should be irrelevant. Prefer an explicit zone name. |
|
Convenience method returning the UTC time zone. |
Created with MrDocs