|
22 | 22 |
|
23 | 23 | #include "format.h" |
24 | 24 |
|
25 | | -namespace fmt_detail { |
26 | | -struct time_zone { |
27 | | - template <typename Duration, typename T> |
28 | | - auto to_sys(T) |
29 | | - -> std::chrono::time_point<std::chrono::system_clock, Duration> { |
30 | | - return {}; |
31 | | - } |
32 | | -}; |
33 | | -template <typename... T> inline auto current_zone(T...) -> time_zone* { |
34 | | - return nullptr; |
35 | | -} |
36 | | - |
37 | | -template <typename... T> inline void _tzset(T...) {} |
38 | | -} // namespace fmt_detail |
39 | | - |
40 | 25 | FMT_BEGIN_NAMESPACE |
41 | 26 |
|
42 | 27 | // Enable safe chrono durations, unless explicitly disabled. |
@@ -519,12 +504,27 @@ auto to_time_t(sys_time<Duration> time_point) -> std::time_t { |
519 | 504 | .count(); |
520 | 505 | } |
521 | 506 |
|
| 507 | +namespace tz { |
| 508 | +struct time_zone { |
| 509 | + template <typename Duration, typename T> |
| 510 | + auto to_sys(T) |
| 511 | + -> std::chrono::time_point<std::chrono::system_clock, Duration> { |
| 512 | + return {}; |
| 513 | + } |
| 514 | +}; |
| 515 | +template <typename... T> inline auto current_zone(T...) -> time_zone* { |
| 516 | + return nullptr; |
| 517 | +} |
| 518 | + |
| 519 | +template <typename... T> inline void _tzset(T...) {} |
| 520 | +} // namespace tz |
| 521 | + |
522 | 522 | // Workaround a bug in libstdc++ which sets __cpp_lib_chrono to 201907 without |
523 | 523 | // providing current_zone(): https://github.com/fmtlib/fmt/issues/4160. |
524 | 524 | template <typename T> FMT_CONSTEXPR auto has_current_zone() -> bool { |
525 | 525 | using namespace std::chrono; |
526 | | - using namespace fmt_detail; |
527 | | - return !std::is_same<decltype(current_zone()), fmt_detail::time_zone*>::value; |
| 526 | + using namespace tz; |
| 527 | + return !std::is_same<decltype(current_zone()), tz::time_zone*>::value; |
528 | 528 | } |
529 | 529 | } // namespace detail |
530 | 530 |
|
@@ -1005,7 +1005,7 @@ struct has_member_data_tm_zone<T, void_t<decltype(T::tm_zone)>> |
1005 | 1005 |
|
1006 | 1006 | inline void tzset_once() { |
1007 | 1007 | static bool init = []() { |
1008 | | - using namespace fmt_detail; |
| 1008 | + using namespace tz; |
1009 | 1009 | _tzset(); |
1010 | 1010 | return false; |
1011 | 1011 | }(); |
|
0 commit comments