summaryrefslogtreecommitdiff
path: root/test/std/language.support/support.runtime/ctime.pass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 18:46:46 +0000
commit61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (patch)
treeec41ed70ffca97240e76f9a78bb2dedba28f310c /test/std/language.support/support.runtime/ctime.pass.cpp
parentf857581820d15e410e9945d2fcd5f7163be25a96 (diff)
Notes
Diffstat (limited to 'test/std/language.support/support.runtime/ctime.pass.cpp')
-rw-r--r--test/std/language.support/support.runtime/ctime.pass.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp
new file mode 100644
index 0000000000000..8c5d2811d8a9e
--- /dev/null
+++ b/test/std/language.support/support.runtime/ctime.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test <ctime>
+
+#include <ctime>
+#include <type_traits>
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef CLOCKS_PER_SEC
+#error CLOCKS_PER_SEC not defined
+#endif
+
+int main()
+{
+ std::clock_t c = 0;
+ std::size_t s = 0;
+ std::time_t t = 0;
+ std::tm tm = {0};
+ static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
+ static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
+ static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
+ static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+ static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
+ static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
+ static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
+ static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
+#endif
+ char* c1 = 0;
+ const char* c2 = 0;
+ static_assert((std::is_same<decltype(std::strftime(c1,s,c2,&tm)), std::size_t>::value), "");
+}