• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
main()21 int main()
22 {
23     std::clock_t c = 0;
24     ((void)c); // avoid unused warning
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 }
39