mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-26 16:01:04 +08:00
Reversed order of arguments to clock_time_conversion.
Now the order of argument matches the clock_cast function. The test only is_clock_castable trait still matches is_convertible order of arguments.
This commit is contained in:
parent
7c69f1570d
commit
543315b700
@ -2197,7 +2197,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
|
||||
return is;
|
||||
}
|
||||
|
||||
template<typename SourceClock, typename DestClock>
|
||||
template<typename DestClock, typename SourceClock>
|
||||
struct clock_time_conversion
|
||||
{};
|
||||
|
||||
@ -2224,7 +2224,7 @@ struct clock_time_conversion<utc_clock, utc_clock>
|
||||
};
|
||||
|
||||
template<>
|
||||
struct clock_time_conversion<std::chrono::system_clock, utc_clock>
|
||||
struct clock_time_conversion<utc_clock, std::chrono::system_clock>
|
||||
{
|
||||
template <class Duration>
|
||||
utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
|
||||
@ -2235,7 +2235,7 @@ struct clock_time_conversion<std::chrono::system_clock, utc_clock>
|
||||
};
|
||||
|
||||
template<>
|
||||
struct clock_time_conversion<utc_clock, std::chrono::system_clock>
|
||||
struct clock_time_conversion<std::chrono::system_clock, utc_clock>
|
||||
{
|
||||
template <class Duration>
|
||||
sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
|
||||
@ -2311,7 +2311,7 @@ namespace ctc_detail
|
||||
}
|
||||
|
||||
template<typename SourceClock>
|
||||
struct clock_time_conversion<SourceClock, std::chrono::system_clock>
|
||||
struct clock_time_conversion<std::chrono::system_clock, SourceClock>
|
||||
{
|
||||
template <class Duration>
|
||||
auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const
|
||||
@ -2322,7 +2322,7 @@ struct clock_time_conversion<SourceClock, std::chrono::system_clock>
|
||||
};
|
||||
|
||||
template<typename DestClock>
|
||||
struct clock_time_conversion<std::chrono::system_clock, DestClock>
|
||||
struct clock_time_conversion<DestClock, std::chrono::system_clock>
|
||||
{
|
||||
template <class Duration>
|
||||
auto operator()(const sys_time<Duration>& st) const
|
||||
@ -2333,7 +2333,7 @@ struct clock_time_conversion<std::chrono::system_clock, DestClock>
|
||||
};
|
||||
|
||||
template<typename SourceClock>
|
||||
struct clock_time_conversion<SourceClock, utc_clock>
|
||||
struct clock_time_conversion<utc_clock, SourceClock>
|
||||
{
|
||||
template <class Duration>
|
||||
auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const
|
||||
@ -2344,7 +2344,7 @@ struct clock_time_conversion<SourceClock, utc_clock>
|
||||
};
|
||||
|
||||
template<typename DestClock>
|
||||
struct clock_time_conversion<utc_clock, DestClock>
|
||||
struct clock_time_conversion<DestClock, utc_clock>
|
||||
{
|
||||
template <class Duration>
|
||||
auto operator()(const utc_time<Duration>& ut) const
|
||||
@ -2358,9 +2358,9 @@ namespace clock_cast_detail
|
||||
{
|
||||
template<typename DestClock, typename SourceClock, typename Duration>
|
||||
auto conv_clock(const std::chrono::time_point<SourceClock, Duration>& st)
|
||||
-> decltype(std::declval<clock_time_conversion<SourceClock, DestClock>>()(st))
|
||||
-> decltype(std::declval<clock_time_conversion<DestClock, SourceClock>>()(st))
|
||||
{
|
||||
return clock_time_conversion<SourceClock, DestClock>{}(st);
|
||||
return clock_time_conversion<DestClock, SourceClock>{}(st);
|
||||
}
|
||||
|
||||
//direct triat conversion, 2nd candidate
|
||||
|
@ -100,7 +100,7 @@ struct s2s_clock
|
||||
namespace date
|
||||
{
|
||||
template<>
|
||||
struct clock_time_conversion<s2s_clock, mil_clock>
|
||||
struct clock_time_conversion<mil_clock, s2s_clock>
|
||||
{
|
||||
template<typename Duration>
|
||||
std::chrono::time_point<mil_clock, std::common_type_t<Duration, date::days>>
|
||||
|
@ -54,7 +54,7 @@ struct steady_based_clock
|
||||
namespace date
|
||||
{
|
||||
template<>
|
||||
struct clock_time_conversion<steady_based_clock, std::chrono::steady_clock>
|
||||
struct clock_time_conversion<std::chrono::steady_clock, steady_based_clock>
|
||||
{
|
||||
template<typename Duration>
|
||||
std::chrono::time_point<std::chrono::steady_clock, Duration>
|
||||
@ -66,7 +66,7 @@ namespace date
|
||||
};
|
||||
|
||||
template<>
|
||||
struct clock_time_conversion<std::chrono::steady_clock, steady_based_clock>
|
||||
struct clock_time_conversion<steady_based_clock, std::chrono::steady_clock>
|
||||
{
|
||||
template<typename Duration>
|
||||
std::chrono::time_point<steady_based_clock, Duration>
|
||||
@ -174,7 +174,7 @@ namespace date
|
||||
{
|
||||
//Disambiguates that sys_clock is preffered
|
||||
template<>
|
||||
struct clock_time_conversion<amb2_clock, amb1_clock>
|
||||
struct clock_time_conversion<amb1_clock, amb2_clock>
|
||||
{
|
||||
template<typename Duration>
|
||||
std::chrono::time_point<amb1_clock, Duration>
|
||||
|
Loading…
x
Reference in New Issue
Block a user