summaryrefslogtreecommitdiffstats
path: root/unittests/Support/TimeValue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/TimeValue.cpp')
-rw-r--r--unittests/Support/TimeValue.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/unittests/Support/TimeValue.cpp b/unittests/Support/TimeValue.cpp
new file mode 100644
index 0000000..27883ae
--- /dev/null
+++ b/unittests/Support/TimeValue.cpp
@@ -0,0 +1,23 @@
+//===- llvm/unittest/Support/TimeValue.cpp - Time Value tests -------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "llvm/Support/TimeValue.h"
+#include <time.h>
+
+using namespace llvm;
+namespace {
+
+TEST(Support, TimeValue) {
+ sys::TimeValue now = sys::TimeValue::now();
+ time_t now_t = time(NULL);
+ EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);
+}
+
+}
OpenPOWER on IntegriCloud