| 25 | #include <type_traits> |
| 26 | |
| 27 | struct const_clock { |
| 28 | using duration = |
| 29 | typename std::common_type<std::chrono::system_clock::duration, |
| 30 | date::days>::type; |
| 31 | using rep = duration::rep; |
| 32 | using period = duration::period; |
| 33 | using time_point = std::chrono::time_point<const_clock, duration>; |
| 34 | |
| 35 | static constexpr date::sys_days epoch { date::days { 1000 } }; |
| 36 | |
| 37 | template <typename Duration> |
| 38 | static std::chrono::time_point<std::chrono::system_clock, |
| 39 | typename std::common_type<Duration, date::days>::type> |
| 40 | CONSTCD11 to_sys(std::chrono::time_point<const_clock, Duration> const& tp) |
| 41 | { |
| 42 | return epoch + tp.time_since_epoch(); |
| 43 | } |
| 44 | |
| 45 | template <typename Duration> |
| 46 | static std::chrono::time_point<const_clock, |
| 47 | typename std::common_type<Duration, date::days>::type> |
| 48 | CONSTCD11 from_sys( |
| 49 | std::chrono::time_point<std::chrono::system_clock, Duration> const& |
| 50 | tp) |
| 51 | { |
| 52 | using res = std::chrono::time_point<const_clock, |
| 53 | typename std::common_type<Duration, date::days>::type>; |
| 54 | return res(tp - epoch); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | int main() |
| 59 | { |
nothing calls this directly
no outgoing calls
no test coverage detected