struct CivilTransition
Defined at line 1196 of file ../../third_party/abseil-cpp/absl/time/time.h
TimeZone::NextTransition()
TimeZone::PrevTransition()
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;
}
Public Members
civil_time from
civil_time to