Skip to content

Commit 9791e73

Browse files
committed
Revert "[libc++][TZDB] Implements time_zone::to_sys. (llvm#90394)"
This reverts commit 77116bd.
1 parent 7eaf993 commit 9791e73

File tree

23 files changed

+70
-1027
lines changed

23 files changed

+70
-1027
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ set(files
250250
__chrono/convert_to_tm.h
251251
__chrono/day.h
252252
__chrono/duration.h
253-
__chrono/exception.h
254253
__chrono/file_clock.h
255254
__chrono/formatter.h
256255
__chrono/hh_mm_ss.h

libcxx/include/__chrono/exception.h

Lines changed: 0 additions & 129 deletions
This file was deleted.

libcxx/include/__chrono/time_zone.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818

1919
# include <__chrono/calendar.h>
2020
# include <__chrono/duration.h>
21-
# include <__chrono/exception.h>
2221
# include <__chrono/local_info.h>
2322
# include <__chrono/sys_info.h>
2423
# include <__chrono/system_clock.h>
2524
# include <__compare/strong_order.h>
2625
# include <__config>
2726
# include <__memory/unique_ptr.h>
28-
# include <__type_traits/common_type.h>
2927
# include <string_view>
3028

3129
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -72,31 +70,6 @@ class _LIBCPP_AVAILABILITY_TZDB time_zone {
7270
return __get_info(chrono::time_point_cast<seconds>(__time));
7371
}
7472

75-
// We don't apply nodiscard here since this function throws on many inputs,
76-
// so it could be used as a validation.
77-
template <class _Duration>
78-
_LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>> to_sys(const local_time<_Duration>& __time) const {
79-
local_info __info = get_info(__time);
80-
switch (__info.result) {
81-
case local_info::unique:
82-
return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
83-
84-
case local_info::nonexistent:
85-
chrono::__throw_nonexistent_local_time(__time, __info);
86-
87-
case local_info::ambiguous:
88-
chrono::__throw_ambiguous_local_time(__time, __info);
89-
}
90-
91-
// TODO TZDB The Standard does not specify anything in these cases.
92-
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
93-
__info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
94-
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
95-
__info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
96-
97-
return {};
98-
}
99-
10073
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
10174

10275
private:

libcxx/include/chrono

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,6 @@ const time_zone* current_zone()
724724
const tzdb& reload_tzdb(); // C++20
725725
string remote_version(); // C++20
726726
727-
// [time.zone.exception], exception classes
728-
class nonexistent_local_time; // C++20
729-
class ambiguous_local_time; // C++20
730-
731727
// [time.zone.info], information classes
732728
struct sys_info { // C++20
733729
sys_seconds begin;
@@ -770,10 +766,6 @@ class time_zone {
770766
771767
template<class Duration>
772768
local_info get_info(const local_time<Duration>& tp) const;
773-
774-
template<class Duration>
775-
sys_time<common_type_t<Duration, seconds>>
776-
to_sys(const local_time<Duration>& tp) const;
777769
};
778770
bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20
779771
strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20
@@ -923,7 +915,6 @@ constexpr chrono::year operator ""y(unsigned lo
923915
#if _LIBCPP_STD_VER >= 20
924916
# include <__chrono/calendar.h>
925917
# include <__chrono/day.h>
926-
# include <__chrono/exception.h>
927918
# include <__chrono/hh_mm_ss.h>
928919
# include <__chrono/literals.h>
929920
# include <__chrono/local_info.h>

libcxx/include/module.modulemap

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,6 @@ module std_private_chrono_duration [system] {
11011101
header "__chrono/duration.h"
11021102
export std_private_type_traits_is_convertible
11031103
}
1104-
module std_private_chrono_exception [system] { header "__chrono/exception.h" }
11051104
module std_private_chrono_file_clock [system] { header "__chrono/file_clock.h" }
11061105
module std_private_chrono_formatter [system] {
11071106
header "__chrono/formatter.h"
@@ -1114,10 +1113,7 @@ module std_private_chrono_high_resolution_clock [system] {
11141113
}
11151114
module std_private_chrono_leap_second [system] { header "__chrono/leap_second.h" }
11161115
module std_private_chrono_literals [system] { header "__chrono/literals.h" }
1117-
module std_private_chrono_local_info [system] {
1118-
header "__chrono/local_info.h"
1119-
export std_private_chrono_sys_info
1120-
}
1116+
module std_private_chrono_local_info [system] { header "__chrono/local_info.h" }
11211117
module std_private_chrono_month [system] { header "__chrono/month.h" }
11221118
module std_private_chrono_month_weekday [system] { header "__chrono/month_weekday.h" }
11231119
module std_private_chrono_monthday [system] { header "__chrono/monthday.h" }

libcxx/modules/std/chrono.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,13 @@ export namespace std {
209209
using std::chrono::reload_tzdb;
210210
using std::chrono::remote_version;
211211

212-
# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
213-
// !defined(_LIBCPP_HAS_NO_LOCALIZATION)
214-
212+
# if 0
215213
// [time.zone.exception], exception classes
216214
using std::chrono::ambiguous_local_time;
217215
using std::chrono::nonexistent_local_time;
216+
# endif // if 0
217+
# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
218+
// !defined(_LIBCPP_HAS_NO_LOCALIZATION)
218219

219220
// [time.zone.info], information classes
220221
using std::chrono::local_info;

libcxx/src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,6 @@ if (LIBCXX_ENABLE_LOCALIZATION AND LIBCXX_ENABLE_FILESYSTEM AND LIBCXX_ENABLE_TI
340340
include/tzdb/types_private.h
341341
include/tzdb/tzdb_list_private.h
342342
include/tzdb/tzdb_private.h
343-
# TODO TZDB The exception could be moved in chrono once the TZDB library
344-
# is no longer experimental.
345-
chrono_exception.cpp
346343
time_zone.cpp
347344
tzdb.cpp
348345
tzdb_list.cpp

libcxx/src/chrono_exception.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)