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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// test <time.h>
10
11#include <time.h>
12
13#include "test_macros.h"
14
15#ifndef NULL
16#error NULL not defined
17#endif
18
19#ifndef CLOCKS_PER_SEC
20#error CLOCKS_PER_SEC not defined
21#endif
22
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(time1: t, time0: t)));
31ASSERT_SAME_TYPE(time_t, decltype(mktime(tp: &tmv)));
32ASSERT_SAME_TYPE(time_t, decltype(time(timer: &t)));
33ASSERT_SAME_TYPE(char*, decltype(asctime(tp: &tmv)));
34ASSERT_SAME_TYPE(char*, decltype(ctime(timer: &t)));
35ASSERT_SAME_TYPE(tm*, decltype(gmtime(timer: &t)));
36ASSERT_SAME_TYPE(tm*, decltype(localtime(timer: &t)));
37ASSERT_SAME_TYPE(size_t, decltype(strftime(s: c1, maxsize: s, format: c2, tp: &tmv)));
38

source code of libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp