Skip to content

Commit 7eaf993

Browse files
committed
Revert "[libc++][TZDB] Implements time_zone::to_sys. (llvm#90901)"
This reverts commit 87cedbe.
1 parent 4067300 commit 7eaf993

File tree

7 files changed

+3
-264
lines changed

7 files changed

+3
-264
lines changed

libcxx/include/__chrono/time_zone.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4242

4343
namespace chrono {
4444

45-
enum class choose { earliest, latest };
46-
4745
class _LIBCPP_AVAILABILITY_TZDB time_zone {
4846
_LIBCPP_HIDE_FROM_ABI time_zone() = default;
4947

@@ -99,36 +97,6 @@ class _LIBCPP_AVAILABILITY_TZDB time_zone {
9997
return {};
10098
}
10199

102-
template <class _Duration>
103-
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>>
104-
to_sys(const local_time<_Duration>& __time, choose __z) const {
105-
local_info __info = get_info(__time);
106-
switch (__info.result) {
107-
case local_info::unique:
108-
case local_info::nonexistent: // first and second are the same
109-
return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
110-
111-
case local_info::ambiguous:
112-
switch (__z) {
113-
case choose::earliest:
114-
return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
115-
116-
case choose::latest:
117-
return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.second.offset};
118-
119-
// Note a value out of bounds is not specified.
120-
}
121-
}
122-
123-
// TODO TZDB The standard does not specify anything in these cases.
124-
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
125-
__info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
126-
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
127-
__info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
128-
129-
return {};
130-
}
131-
132100
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
133101

134102
private:

libcxx/include/chrono

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,6 @@ class time_zone {
774774
template<class Duration>
775775
sys_time<common_type_t<Duration, seconds>>
776776
to_sys(const local_time<Duration>& tp) const;
777-
778-
template<class Duration>
779-
sys_time<common_type_t<Duration, seconds>>
780-
to_sys(const local_time<Duration>& tp, choose z) const;
781777
};
782778
bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20
783779
strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20

libcxx/modules/std/chrono.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,11 @@ export namespace std {
223223
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
224224
!defined(_LIBCPP_HAS_NO_LOCALIZATION)
225225

226+
# if 0
226227
// [time.zone.timezone], class time_zone
227228
using std::chrono::choose;
229+
# endif // if 0
230+
228231
using std::chrono::time_zone;
229232

230233
# if 0

libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,9 @@ void test() {
4949
{
5050
std::chrono::sys_seconds s{};
5151
std::chrono::local_seconds l{};
52-
std::chrono::choose z = std::chrono::choose::earliest;
5352
tz.name(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5453
tz.get_info(s); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5554
tz.get_info(l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
56-
tz.to_sys(l); // not nodiscard
57-
tz.to_sys(l, z); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5855
operator==(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
5956
operator<=>(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
6057
}

libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.pass.cpp

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

libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp

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

libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.pass.cpp

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

0 commit comments

Comments
 (0)