[#absl-TimeZone-CivilTransition] = xref:absl.adoc[absl]::xref:absl/TimeZone.adoc[TimeZone]::CivilTransition :relfileprefix: ../../ :mrdocs: A transition in a time zone: the civil times just before and after an offset change. == Synopsis Declared in `<absl/time/time.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct CivilTransition; ---- == Description Finds the time of the next/previous offset change in this time zone. By definition, `NextTransition(t, &trans)` returns false when `t` is `InfiniteFuture()`, and `PrevTransition(t, &trans)` returns false when `t` is `InfinitePast()`. If the zone has no transitions, the result will also be false no matter what the argument. Otherwise, when `t` is `InfinitePast()`, `NextTransition(t, &trans)` returns true and sets `trans` to the first recorded transition. Chains of calls to `NextTransition()/PrevTransition()` will eventually return false, but it is unspecified exactly when `NextTransition(t, &trans)` jumps to false, or what time is set by `PrevTransition(t, &trans)` for a very distant `t`. Note: Enumeration of time‐zone transitions is for informational purposes only. Modern time‐related code should not care about when offset changes occur. Example: absl::TimeZone nyc; if (!absl::LoadTimeZone("America/New_York", &nyc)) { ... } const auto now = absl::Now(); auto t = absl::InfinitePast(); absl::TimeZone::CivilTransition trans; while (t <= now && nyc.NextTransition(t, &trans)) { // transition: trans.from ‐> trans.to t = nyc.At(trans.to).trans; } == Data Members [cols="1,4"] |=== | Name| Description | xref:absl/TimeZone/CivilTransition/from.adoc[`from`] | the civil time we jump from | xref:absl/TimeZone/CivilTransition/to.adoc[`to`] | the civil time we jump to |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#