[libcxx-commits] [libcxx] [libc++][chrono] implements UTC clock. (PR #90393)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 16 09:16:55 PDT 2024


================
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-incomplete-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class utc_clock {
+// public:
+//     using rep                       = a signed arithmetic type;
+//     using period                    = ratio<unspecified, unspecified>;
+//     using duration                  = chrono::duration<rep, period>;
+//     using time_point                = chrono::time_point<utc_clock>;
+//     static constexpr bool is_steady = unspecified;
+//
+//     ...
+// };
+//
+// template<class Duration>
+// using utc_time  = time_point<utc_clock, Duration>;
+// using utc_seconds = utc_time<seconds>;
+
+#include <concepts>
+#include <chrono>
+
+#include "test_macros.h"
+
+// class utc_clock
+using rep                = std::chrono::utc_clock::rep;
+using period             = std::chrono::utc_clock::period;
+using duration           = std::chrono::utc_clock::duration;
+using time_point         = std::chrono::utc_clock::time_point;
+constexpr bool is_steady = std::chrono::utc_clock::is_steady;
+
+// Tests the values. part of them are implementation defined.
----------------
ldionne wrote:

```suggestion
// Tests the values. Some of them are implementation-defined.
```

https://github.com/llvm/llvm-project/pull/90393


More information about the libcxx-commits mailing list