diff --git a/tz.cpp b/tz.cpp index fbf5477..080749d 100644 --- a/tz.cpp +++ b/tz.cpp @@ -485,7 +485,7 @@ parse_signed_time(std::istream& in) // MonthDayTime -MonthDayTime::MonthDayTime(seconds_point tp, tz timezone) +MonthDayTime::MonthDayTime(second_point tp, tz timezone) : zone_(timezone) { using namespace date; @@ -578,7 +578,7 @@ MonthDayTime::compare(date::year y, const MonthDayTime& x, date::year yx, return t0 < t1 ? -1 : t0 == t1 ? 0 : 1; } -seconds_point +second_point MonthDayTime::to_sys(date::year y, std::chrono::seconds offset, std::chrono::seconds save) const { @@ -640,7 +640,7 @@ MonthDayTime::to_day_point(date::year y) const return day_point(x) + (wd1-wd0); } -seconds_point +second_point MonthDayTime::to_time_point(date::year y) const { return to_day_point(y) + h_ + m_ + s_; @@ -1411,8 +1411,8 @@ find_rule_for_zone(const std::pair& eqr, static std::pair find_rule_for_zone(const std::pair& eqr, - const seconds_point& tp_utc, const seconds_point& tp_std, - const seconds_point& tp_loc) + const second_point& tp_utc, const second_point& tp_std, + const second_point& tp_loc) { using namespace std::chrono; using namespace date; @@ -1630,7 +1630,7 @@ Zone::get_info(std::chrono::system_clock::time_point tp, tz timezone) const + std::to_string(static_cast(max_year)) + "]"); auto tps = floor(tp); auto i = std::upper_bound(zonelets_.begin(), zonelets_.end(), tps, - [timezone](seconds_point t, const zonelet& zl) + [timezone](second_point t, const zonelet& zl) { return timezone == tz::utc ? t < zl.until_utc_ : t < zl.until_loc_; }); diff --git a/tz.h b/tz.h index 8f1b4be..4016c6f 100644 --- a/tz.h +++ b/tz.h @@ -54,8 +54,8 @@ Technically any OS may required mapping. namespace date { -using seconds_point = std::chrono::time_point; +using second_point = std::chrono::time_point; enum class tz {utc, local, standard}; enum class choose {earliest, latest}; @@ -67,9 +67,9 @@ public: template nonexistent_local_time(std::chrono::time_point> tp, - seconds_point first, const std::string& first_abbrev, - seconds_point last, const std::string& last_abbrev, - seconds_point time_sys); + second_point first, const std::string& first_abbrev, + second_point last, const std::string& last_abbrev, + second_point time_sys); private: template @@ -77,9 +77,9 @@ private: std::string make_msg(std::chrono::time_point> tp, - seconds_point first, const std::string& first_abbrev, - seconds_point last, const std::string& last_abbrev, - seconds_point time_sys); + second_point first, const std::string& first_abbrev, + second_point last, const std::string& last_abbrev, + second_point time_sys); }; template @@ -87,9 +87,9 @@ inline nonexistent_local_time::nonexistent_local_time( std::chrono::time_point> tp, - seconds_point first, const std::string& first_abbrev, - seconds_point last, const std::string& last_abbrev, - seconds_point time_sys) + second_point first, const std::string& first_abbrev, + second_point last, const std::string& last_abbrev, + second_point time_sys) : std::runtime_error(make_msg(tp, first, first_abbrev, last, last_abbrev, time_sys)) {} @@ -97,9 +97,9 @@ template std::string nonexistent_local_time::make_msg(std::chrono::time_point> tp, - seconds_point first, const std::string& first_abbrev, - seconds_point last, const std::string& last_abbrev, - seconds_point time_sys) + second_point first, const std::string& first_abbrev, + second_point last, const std::string& last_abbrev, + second_point time_sys) { using namespace date; std::ostringstream os; @@ -167,8 +167,8 @@ class Rule; struct Info { - seconds_point begin; - seconds_point end; + second_point begin; + second_point end; std::chrono::seconds offset; std::chrono::minutes save; std::string abbrev; @@ -360,12 +360,12 @@ inline bool operator>=(const Link& x, const Link& y) {return !(x < y);} class Leap { private: - seconds_point date_; + second_point date_; public: explicit Leap(const std::string& s); - seconds_point date() const {return date_;} + second_point date() const {return date_;} friend bool operator==(const Leap& x, const Leap& y) {return x.date_ == y.date_;} friend bool operator< (const Leap& x, const Leap& y) {return x.date_ < y.date_;} diff --git a/tz_private.h b/tz_private.h index d584d4e..1c2c2d2 100644 --- a/tz_private.h +++ b/tz_private.h @@ -40,7 +40,7 @@ private: public: MonthDayTime() = default; - MonthDayTime(seconds_point tp, tz timezone); + MonthDayTime(second_point tp, tz timezone); MonthDayTime(const date::month_day& md, tz timezone); date::day day() const; @@ -49,11 +49,11 @@ public: void canonicalize(date::year y); - seconds_point + second_point to_sys(date::year y, std::chrono::seconds offset, std::chrono::seconds save) const; date::day_point to_day_point(date::year y) const; - seconds_point to_time_point(date::year y) const; + second_point to_time_point(date::year y) const; int compare(date::year y, const MonthDayTime& x, date::year yx, std::chrono::seconds offset, std::chrono::minutes prev_save) const; @@ -160,9 +160,9 @@ struct Zone::zonelet std::string format_; date::year until_year_{0}; MonthDayTime until_date_; - seconds_point until_utc_; - seconds_point until_std_; - seconds_point until_loc_; + second_point until_utc_; + second_point until_std_; + second_point until_loc_; std::chrono::minutes initial_save_{}; std::string initial_abbrev_; std::pair first_rule_{nullptr, date::year::min()};