Home | History | Annotate | Download | only in date.time
      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 
     21 int main()
     22 {
     23     std::clock_t c = 0;
     24     std::size_t s = 0;
     25     std::time_t t = 0;
     26     std::tm tm = {0};
     27     char str[3];
     28     static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
     29     static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
     30     static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
     31     static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
     32     static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
     33     static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
     34     static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
     35     static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
     36     static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
     37 }
     38