Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 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 | |
| 21 | int main() |
| 22 | { |
| 23 | std::clock_t c = 0; |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 24 | ((void)c); // avoid unused warning |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 25 | std::size_t s = 0; |
| 26 | std::time_t t = 0; |
| 27 | std::tm tm = {0}; |
| 28 | char str[3]; |
| 29 | static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), ""); |
| 30 | static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), ""); |
| 31 | static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), ""); |
| 32 | static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), ""); |
| 33 | static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), ""); |
| 34 | static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), ""); |
| 35 | static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), ""); |
| 36 | static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), ""); |
| 37 | static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), ""); |
| 38 | } |