Skip to content

Commit

Permalink
[libc++][TZDB] Fixes CI.
Browse files Browse the repository at this point in the history
The commit 24e70e3 changed internal
macros which were used in 0cd794d.

This caused build failures on platforms without TZDB support
  • Loading branch information
mordante committed Jan 24, 2025
1 parent 83df39c commit 3b30f20
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions libcxx/include/__chrono/convert_to_tm.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const chrono::sys_time<_Duration> __tp
}

# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB

template <class _Tm, class _Duration>
_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::utc_time<_Duration> __tp) {
Expand All @@ -112,7 +112,7 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::utc_time<_Duration> __tp) {
return __result;
}

# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION

// Convert a chrono (calendar) time point, or dururation to the given _Tm type,
Expand All @@ -128,10 +128,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
if constexpr (same_as<typename _ChronoT::clock, chrono::system_clock>)
return std::__convert_to_tm<_Tm>(__value);
# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB
else if constexpr (same_as<typename _ChronoT::clock, chrono::utc_clock>)
return std::__convert_to_tm<_Tm>(__value);
# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
else if constexpr (same_as<typename _ChronoT::clock, chrono::file_clock>)
return std::__convert_to_tm<_Tm>(_ChronoT::clock::to_sys(__value));
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<chrono::sys_time<_Duration>, _CharT> : pub
};

# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB

template <class _Duration, __fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<chrono::utc_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
Expand All @@ -734,7 +734,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<chrono::utc_time<_Duration>, _CharT> : pub
}
};

# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM

template <class _Duration, __fmt_char_type _CharT>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_days& __dp) {
}

# if _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# if _LIBCPP_HAS_EXPERIMENTAL_TZDB

template <class _CharT, class _Traits, class _Duration>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const utc_time<_Duration>& __tp) {
return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
}

# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
# endif // _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM

template <class _CharT, class _Traits, class _Duration>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/utc_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <version>
// Enable the contents of the header only when libc++ was built with experimental features enabled.
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
#if _LIBCPP_HAS_EXPERIMENTAL_TZDB

# include <__chrono/duration.h>
# include <__chrono/leap_second.h>
Expand Down Expand Up @@ -158,6 +158,6 @@ utc_clock::to_sys(const utc_time<_Duration>& __time) {

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB

#endif // _LIBCPP___CHRONO_UTC_CLOCK_H

0 comments on commit 3b30f20

Please sign in to comment.