1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include <ctime> 11#include <type_traits> 12 13#ifndef NULL 14#error NULL not defined 15#endif 16 17#ifndef CLOCKS_PER_SEC 18#error CLOCKS_PER_SEC not defined 19#endif 20 21int main() 22{ 23 std::clock_t c = 0; 24 std::size_t s = 0; 25 std::time_t t = 0; 26 std::tm tm = {}; 27 char str[3]; 28 ((void)c); // Prevent unused warning 29 ((void)s); // Prevent unused warning 30 ((void)t); // Prevent unused warning 31 ((void)tm); // Prevent unused warning 32 ((void)str); // Prevent unused warning 33 static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), ""); 34 static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), ""); 35 static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), ""); 36 static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), ""); 37#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS 38 static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), ""); 39 static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), ""); 40 static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), ""); 41 static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), ""); 42#endif 43 static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), ""); 44} 45