[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,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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;
+
+// static time_point now();
+
+#include <chrono>
+#include <cassert>
+
+int main(int, const char**) {
+  using clock                                      = std::chrono::utc_clock;
+  std::same_as<clock::time_point> decltype(auto) t = clock::now();
----------------
ldionne wrote:

Could we for example call `clock::now()` twice and check that the two values are within a day from each other? You can also include a comment that says "this is technically flaky, but in practice we want to know if that isn't the case".

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


More information about the libcxx-commits mailing list