33 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: no-monotonic-clock10 11// <chrono>12 13// steady_clock14 15// static time_point now();16 17#include <chrono>18#include <cassert>19 20#include "test_macros.h"21 22int main(int, char**)23{24 typedef std::chrono::steady_clock C;25 C::time_point t1 = C::now();26 C::time_point t2 = C::now();27 assert(t2 >= t1);28 // make sure t2 didn't wrap around29 assert(t2 > std::chrono::time_point<C>());30 31 return 0;32}33