diff --git a/tz.cpp b/tz.cpp index 277f636..e3edbd4 100644 --- a/tz.cpp +++ b/tz.cpp @@ -1007,6 +1007,22 @@ find_next_rule(const Rule* r, date::year y) return {r, y}; } +static +const Rule* +find_first_std_rule(const std::pair& eqr) +{ + auto r = eqr.first; + auto ry = r->starting_year(); + while (r->save() != std::chrono::minutes{0}) + { + std::tie(r, ry) = find_next_rule(eqr.first, eqr.second, r, ry); + if (r == nullptr) + throw std::runtime_error("Could not find standard offset in rule " + + eqr.first->name()); + } + return r; +} + static std::pair find_rule_for_zone(const std::pair& eqr, @@ -1218,7 +1234,10 @@ Zone::adjust_infos(const std::vector& rules) } } if (z.first_rule_.first == nullptr && z.last_rule_.first != nullptr) + { z.first_rule_ = std::make_pair(eqr.first, eqr.first->starting_year()); + z.initial_abbrev_ = find_first_std_rule(eqr)->abbrev(); + } } #ifndef NDEBUG