brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · b7eb77b Raw
38 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// test <time.h>10 11#include <time.h>12 13#include "test_macros.h"14 15#ifndef NULL16#error NULL not defined17#endif18 19#ifndef CLOCKS_PER_SEC20#error CLOCKS_PER_SEC not defined21#endif22 23clock_t c = 0;24size_t s = 0;25time_t t = 0;26tm tmv = {};27char* c1 = 0;28const char* c2 = 0;29ASSERT_SAME_TYPE(clock_t, decltype(clock()));30ASSERT_SAME_TYPE(double,  decltype(difftime(t, t)));31ASSERT_SAME_TYPE(time_t,  decltype(mktime(&tmv)));32ASSERT_SAME_TYPE(time_t,  decltype(time(&t)));33ASSERT_SAME_TYPE(char*,   decltype(asctime(&tmv)));34ASSERT_SAME_TYPE(char*,   decltype(ctime(&t)));35ASSERT_SAME_TYPE(tm*,     decltype(gmtime(&t)));36ASSERT_SAME_TYPE(tm*,     decltype(localtime(&t)));37ASSERT_SAME_TYPE(size_t,  decltype(strftime(c1, s, c2, &tmv)));38