diff --git a/date.h b/date.h index f16886d..e5477ef 100644 --- a/date.h +++ b/date.h @@ -3633,7 +3633,7 @@ public: CONSTCD14 explicit operator precision() const NOEXCEPT { - return to24hr() + m_ + s_; + return to24hr() + s_ + m_; } CONSTCD14 precision to_duration() const NOEXCEPT @@ -3714,7 +3714,7 @@ public: CONSTCD14 explicit operator precision() const NOEXCEPT { - return to24hr() + m_ + s_ + sub_s_; + return to24hr() + s_ + sub_s_ + m_; } CONSTCD14 precision to_duration() const NOEXCEPT diff --git a/tz.cpp b/tz.cpp index 3193469..592e1d7 100644 --- a/tz.cpp +++ b/tz.cpp @@ -708,7 +708,8 @@ MonthDayTime::to_sys_days(date::year y) const sys_seconds MonthDayTime::to_time_point(date::year y) const { - return to_sys_days(y) + h_ + m_ + s_; + // Add seconds first to promote to largest rep early to prevent overflow + return to_sys_days(y) + s_ + h_ + m_; } void @@ -871,7 +872,7 @@ operator<<(std::ostream& os, const MonthDayTime& x) } break; } - os << date::make_time(x.h_ + x.m_ + x.s_); + os << date::make_time(x.s_ + x.h_ + x.m_); if (x.zone_ == tz::utc) os << "UTC "; else if (x.zone_ == tz::standard)