Restored deprecated to_clock_time function.

Fixed the to_utc_time(const gps_time<Duration>& t) function
to correctly use clock_cast<utc_time>.

Added test to deprecated functions.
This commit is contained in:
Tomasz Kamiński
2017-11-24 23:37:32 +01:00
parent d4592bd497
commit b13c859ff1
2 changed files with 203 additions and 0 deletions
+101
View File
@@ -2417,6 +2417,107 @@ auto clock_cast(const std::chrono::time_point<SourceClock, Duration>& st)
return clock_cast_detail::cc_impl<DestClock>(st, &st);
}
// Deprecated API
template <class Duration>
inline
sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_sys_time(const utc_time<Duration>& t)
{
return clock_cast<std::chrono::system_clock>(t);
}
template <class Duration>
inline
sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_sys_time(const tai_time<Duration>& t)
{
return clock_cast<std::chrono::system_clock>(t);
}
template <class Duration>
inline
sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_sys_time(const gps_time<Duration>& t)
{
return clock_cast<std::chrono::system_clock>(t);
}
template <class Duration>
inline
utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_utc_time(const sys_time<Duration>& t)
{
return clock_cast<utc_clock>(t);
}
template <class Duration>
inline
utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_utc_time(const tai_time<Duration>& t)
{
return clock_cast<utc_clock>(t);
}
template <class Duration>
inline
utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_utc_time(const gps_time<Duration>& t)
{
return clock_cast<utc_clock>(t);
}
template <class Duration>
inline
tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_tai_time(const sys_time<Duration>& t)
{
return clock_cast<tai_clock>(t);
}
template <class Duration>
inline
tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_tai_time(const utc_time<Duration>& t)
{
return clock_cast<tai_clock>(t);
}
template <class Duration>
inline
tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_tai_time(const gps_time<Duration>& t)
{
return clock_cast<tai_clock>(t);
}
template <class Duration>
inline
gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_gps_time(const sys_time<Duration>& t)
{
return clock_cast<gps_clock>(t);
}
template <class Duration>
inline
gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_gps_time(const utc_time<Duration>& t)
{
return clock_cast<gps_clock>(t);
}
template <class Duration>
inline
gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_gps_time(const tai_time<Duration>& t)
{
return clock_cast<gps_clock>(t);
}
#endif // !MISSING_LEAP_SECONDS
} // namespace date