@@ -282,8 +282,6 @@ namespace detail {
282282#define FMT_NOMACRO
283283
284284template <typename T = void > struct null {};
285- inline auto localtime_r FMT_NOMACRO (...) -> null<> { return null<>(); }
286- inline auto localtime_s (...) -> null<> { return null<>(); }
287285inline auto gmtime_r (...) -> null<> { return null<>(); }
288286inline auto gmtime_s (...) -> null<> { return null<>(); }
289287
@@ -501,74 +499,10 @@ auto to_time_t(sys_time<Duration> time_point) -> std::time_t {
501499 .count ();
502500}
503501
504- namespace tz {
505-
506- // DEPRECATED!
507- struct time_zone {
508- template <typename Duration, typename LocalTime>
509- auto to_sys (LocalTime) -> sys_time<Duration> {
510- return {};
511- }
512- };
513- template <typename ... T> auto current_zone (T...) -> time_zone* {
514- return nullptr ;
515- }
516- } // namespace tz
517502} // namespace detail
518503
519504FMT_BEGIN_EXPORT
520505
521- /* *
522- * Converts given time since epoch as `std::time_t` value into calendar time,
523- * expressed in local time. Unlike `std::localtime`, this function is
524- * thread-safe on most platforms.
525- */
526- FMT_DEPRECATED inline auto localtime (std::time_t time) -> std::tm {
527- struct dispatcher {
528- std::time_t time_;
529- std::tm tm_;
530-
531- inline dispatcher (std::time_t t) : time_(t) {}
532-
533- inline auto run () -> bool {
534- using namespace fmt ::detail;
535- return handle (localtime_r (&time_, &tm_));
536- }
537-
538- inline auto handle (std::tm* tm) -> bool { return tm != nullptr ; }
539-
540- inline auto handle (detail::null<>) -> bool {
541- using namespace fmt ::detail;
542- return fallback (localtime_s (&tm_, &time_));
543- }
544-
545- inline auto fallback (int res) -> bool { return res == 0 ; }
546-
547- #if !FMT_MSC_VERSION
548- inline auto fallback (detail::null<>) -> bool {
549- using namespace fmt ::detail;
550- std::tm* tm = std::localtime (&time_);
551- if (tm) tm_ = *tm;
552- return tm != nullptr ;
553- }
554- #endif
555- };
556- dispatcher lt (time);
557- // Too big time values may be unsupported.
558- if (!lt.run ()) FMT_THROW (format_error (" time_t value out of range" ));
559- return lt.tm_ ;
560- }
561-
562- #if FMT_USE_LOCAL_TIME
563- template <typename Duration>
564- FMT_DEPRECATED auto localtime (std::chrono::local_time<Duration> time)
565- -> std::tm {
566- using namespace std ::chrono;
567- using namespace detail ::tz;
568- return localtime (detail::to_time_t (current_zone ()->to_sys <Duration>(time)));
569- }
570- #endif
571-
572506/* *
573507 * Converts given time since epoch as `std::time_t` value into calendar time,
574508 * expressed in Coordinated Universal Time (UTC). Unlike `std::gmtime`, this
0 commit comments