A transition in a time zone: the civil times just before and after an offset change.
Declared in <absl/time/time.h>
struct CivilTransition;
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; }
| Name | Description |
|---|---|
from | the civil time we jump from |
to | the civil time we jump to |