diff --git a/tz.h b/tz.h index 5b001b5..a83c6f3 100644 --- a/tz.h +++ b/tz.h @@ -1013,7 +1013,7 @@ public: using rep = duration::rep; using period = duration::period; using time_point = std::chrono::time_point; - static CONSTDATA bool is_steady = true; + static CONSTDATA bool is_steady = false; static time_point now() NOEXCEPT; }; @@ -1104,7 +1104,7 @@ public: using rep = duration::rep; using period = duration::period; using time_point = std::chrono::time_point; - static const bool is_steady = true; + static const bool is_steady = false; static time_point now() NOEXCEPT; }; @@ -1121,7 +1121,7 @@ to_utc_time(tai_time t) { using namespace std::chrono; using duration = typename std::common_type::type; - return utc_time{t.time_since_epoch()} - + return utc_time{t.time_since_epoch()} - (sys_days{year{1970}/jan/1} - sys_days{year{1958}/jan/1} + seconds{10}); } @@ -1132,16 +1132,24 @@ to_tai_time(utc_time t) { using namespace std::chrono; using duration = typename std::common_type::type; - return tai_time{t.time_since_epoch()} + + return tai_time{t.time_since_epoch()} + (sys_days{year{1970}/jan/1} - sys_days{year{1958}/jan/1} + seconds{10}); } +template +inline +tai_time::type> +to_tai_time(sys_time t) +{ + return to_tai_time(to_utc_time(t)); +} + inline tai_clock::time_point tai_clock::now() NOEXCEPT { using namespace std::chrono; - return to_tai_time(utc_clock::now()); + return to_tai_time(system_clock::now()); } template @@ -1164,7 +1172,7 @@ public: using rep = duration::rep; using period = duration::period; using time_point = std::chrono::time_point; - static const bool is_steady = true; + static const bool is_steady = false; static time_point now() NOEXCEPT; }; @@ -1196,12 +1204,20 @@ to_gps_time(utc_time t) (sys_days{year{1980}/jan/sun[1]} - sys_days{year{1970}/jan/1} + seconds{9}); } +template +inline +gps_time::type> +to_gps_time(sys_time t) +{ + return to_gps_time(to_utc_time(t)); +} + inline gps_clock::time_point gps_clock::now() NOEXCEPT { using namespace std::chrono; - return to_gps_time(utc_clock::now()); + return to_gps_time(system_clock::now()); } template @@ -1231,28 +1247,15 @@ to_sys_time(gps_time t) return to_sys_time(to_utc_time(t)); } -template -inline -tai_time::type> -to_tai_time(sys_time t) -{ - return to_tai_time(to_utc_time(t)); -} - template inline tai_time::type> to_tai_time(gps_time t) { - return to_tai_time(to_utc_time(t)); -} - -template -inline -gps_time::type> -to_gps_time(sys_time t) -{ - return to_gps_time(to_utc_time(t)); + using namespace std::chrono; + using duration = typename std::common_type::type; + return tai_time{t.time_since_epoch()} + + (sys_days{year{1980}/jan/sun[1]} - sys_days{year{1958}/jan/1} + seconds{19}); } template @@ -1260,7 +1263,10 @@ inline gps_time::type> to_gps_time(tai_time t) { - return to_gps_time(to_utc_time(t)); + using namespace std::chrono; + using duration = typename std::common_type::type; + return gps_time{t.time_since_epoch()} - + (sys_days{year{1980}/jan/sun[1]} - sys_days{year{1958}/jan/1} + seconds{19}); } // format