blob: 0d229af409bde893e19898547464b7fd4abc57b2 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
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
23int main()
24{
Eric Fiselier212714f2015-07-18 22:51:51 +000025 clock_t c = 0; ((void)c);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000026 size_t s = 0;
27 time_t t = 0;
Dan Albert1d4a1ed2016-05-25 22:36:09 -070028 tm tmv = {0};
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000029 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}