Michael J. Spencer | f2ca4cb | 2010-11-24 19:20:05 +0000 | [diff] [blame^] | 1 | //===- llvm/unittest/System/TimeValue.cpp - Time Vlaue tests --------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "gtest/gtest.h" |
| 11 | #include "llvm/System/TimeValue.h" |
| 12 | #include <time.h> |
| 13 | |
| 14 | using namespace llvm; |
| 15 | namespace { |
| 16 | |
| 17 | TEST(System, TimeValue) { |
| 18 | sys::TimeValue now = sys::TimeValue::now(); |
| 19 | time_t now_t = time(NULL); |
| 20 | EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2); |
| 21 | } |
| 22 | |
| 23 | } |