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(t, t))); 31 ASSERT_SAME_TYPE(time_t, decltype(mktime(&tmv))); 32 ASSERT_SAME_TYPE(time_t, decltype(time(&t))); 33 ASSERT_SAME_TYPE(char*, decltype(asctime(&tmv))); 34 ASSERT_SAME_TYPE(char*, decltype(ctime(&t))); 35 ASSERT_SAME_TYPE(tm*, decltype(gmtime(&t))); 36 ASSERT_SAME_TYPE(tm*, decltype(localtime(&t))); 37 ASSERT_SAME_TYPE(size_t, decltype(strftime(c1, s, c2, &tmv))); 38