summaryrefslogtreecommitdiff
path: root/unittests/Support/TimeValue.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-20 12:57:14 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-20 12:57:14 +0000
commitcf099d11218cb6f6c5cce947d6738e347f07fb12 (patch)
treed2b61ce94e654cb01a254d2195259db5f9cc3f3c /unittests/Support/TimeValue.cpp
parent49011b52fcba02a6051957b84705159f52fae4e4 (diff)
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 0000000000000..27883ae335640
--- /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);
+}
+
+}