summaryrefslogtreecommitdiff
path: root/unittests/System/TimeValue.cpp
blob: d1da5c14ee6572ba806adcfc7d78bc9d1ff194cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//===- llvm/unittest/System/TimeValue.cpp - Time Vlaue 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/System/TimeValue.h"
#include <time.h>

using namespace llvm;
namespace {

TEST(System, TimeValue) {
  sys::TimeValue now = sys::TimeValue::now();
  time_t now_t = time(NULL);
  EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);
}

}