Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame^] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // test <time.h> |
| 11 | |
| 12 | #include <time.h> |
| 13 | #include <type_traits> |
| 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 | int main() |
| 24 | { |
| 25 | clock_t c = 0; |
| 26 | size_t s = 0; |
| 27 | time_t t = 0; |
| 28 | tm tmv = {0}; |
| 29 | static_assert((std::is_same<decltype(clock()), clock_t>::value), ""); |
| 30 | static_assert((std::is_same<decltype(difftime(t,t)), double>::value), ""); |
| 31 | static_assert((std::is_same<decltype(mktime(&tmv)), time_t>::value), ""); |
| 32 | static_assert((std::is_same<decltype(time(&t)), time_t>::value), ""); |
| 33 | static_assert((std::is_same<decltype(asctime(&tmv)), char*>::value), ""); |
| 34 | static_assert((std::is_same<decltype(ctime(&t)), char*>::value), ""); |
| 35 | static_assert((std::is_same<decltype(gmtime(&t)), tm*>::value), ""); |
| 36 | static_assert((std::is_same<decltype(localtime(&t)), tm*>::value), ""); |
| 37 | char* c1 = 0; |
| 38 | const char* c2 = 0; |
| 39 | static_assert((std::is_same<decltype(strftime(c1,s,c2,&tmv)), size_t>::value), ""); |
| 40 | } |