[#absl-TimeZone] = xref:absl.adoc[absl]::TimeZone :relfileprefix: ../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:absl/TimeZone/CivilInfo.adoc[`CivilInfo`] | 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 `TimeZone::CivilInfo` to a function, pass an `absl::Time` and an `absl::TimeZone`. | xref:absl/TimeZone/CivilTransition.adoc[`CivilTransition`] | A transition in a time zone: the civil times just before and after an offset change. | xref:absl/TimeZone/TimeInfo.adoc[`TimeInfo`] | Information about the absolute times corresponding to a civil time. (Subseconds must be handled separately.) |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/TimeZone/2constructor-00.adoc[`TimeZone`] [.small]#[constructor]# | Constructors | xref:absl/TimeZone/operator_assign.adoc[`operator=`] | Assigns a copy of another time zone. | xref:absl/TimeZone/At-05.adoc[`At`] | `At` overloads | xref:absl/TimeZone/NextTransition.adoc[`NextTransition`] | Finds the next offset change in this time zone at or after a given time. | xref:absl/TimeZone/PrevTransition.adoc[`PrevTransition`] | Finds the previous offset change in this time zone before a given time. | xref:absl/TimeZone/name.adoc[`name`] | Returns the TZ identifier name of this time zone. | xref:absl/TimeZone/2conversion.adoc[`operator /* implementation-defined */::cctz::time_zone`] | Converts this time zone to the underlying cctz time zone. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/operator_lshift-032.adoc[absl::operator<<]` | Writes the time zone's name to an output stream. | `xref:absl/operator_not_eq-0e1.adoc[absl::operator!=]` | Returns whether two time zones are unequal. | `xref:absl/operator_eq-0dc.adoc[absl::operator==]` | Returns whether two time zones are equal. | `xref:absl/AbslHashValue-070.adoc[absl::AbslHashValue]` | Combines this time zone into a hash state. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/FixedTimeZone.adoc[`FixedTimeZone`] | 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. | xref:absl/LocalTimeZone.adoc[`LocalTimeZone`] | 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. | xref:absl/UTCTimeZone.adoc[`UTCTimeZone`] | Convenience method returning the UTC time zone. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#