| 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 | |
| 23 | clock_t c = 0; |
| 24 | size_t s = 0; |
| 25 | time_t t = 0; |
| 26 | tm tmv = {}; |
| 27 | char* c1 = 0; |
| 28 | const char* c2 = 0; |
| 29 | ASSERT_SAME_TYPE(clock_t, decltype(clock())); |
| 30 | ASSERT_SAME_TYPE(double, decltype(difftime(time1: t, time0: t))); |
| 31 | ASSERT_SAME_TYPE(time_t, decltype(mktime(tp: &tmv))); |
| 32 | ASSERT_SAME_TYPE(time_t, decltype(time(timer: &t))); |
| 33 | ASSERT_SAME_TYPE(char*, decltype(asctime(tp: &tmv))); |
| 34 | ASSERT_SAME_TYPE(char*, decltype(ctime(timer: &t))); |
| 35 | ASSERT_SAME_TYPE(tm*, decltype(gmtime(timer: &t))); |
| 36 | ASSERT_SAME_TYPE(tm*, decltype(localtime(timer: &t))); |
| 37 | ASSERT_SAME_TYPE(size_t, decltype(strftime(s: c1, maxsize: s, format: c2, tp: &tmv))); |
| 38 | |