39 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710// UNSUPPORTED: no-filesystem, no-localization, no-tzdb11 12// XFAIL: libcpp-has-no-experimental-tzdb13// XFAIL: availability-tzdb-missing14 15// <chrono>16//17// class utc_clock;18 19// static time_point now();20 21#include <chrono>22#include <concepts>23#include <cassert>24 25int main(int, const char**) {26 using clock = std::chrono::utc_clock;27 std::same_as<clock::time_point> decltype(auto) t = clock::now();28 29 assert(t >= clock::time_point::min());30 assert(t <= clock::time_point::max());31 32 auto t2 = clock::now();33 assert(t2 - t >= std::chrono::seconds(0));34 // This may fail if the tests takes a long time to complete.35 assert(t2 - t < std::chrono::seconds(42));36 37 return 0;38}39