blob: 0fd567501517f0bd908e689c00a43dd374af2e4c [file] [log] [blame]
NAKAMURA Takumie7f03932013-07-16 02:03:32 +00001//===- llvm/unittest/Support/TimeValueTest.cpp - Time Value tests ---------===//
Michael J. Spencerf2ca4cb2010-11-24 19:20:05 +00002//
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"
Michael J. Spencer1f6efa32010-11-29 18:16:10 +000011#include "llvm/Support/TimeValue.h"
Michael J. Spencerf2ca4cb2010-11-24 19:20:05 +000012#include <time.h>
13
14using namespace llvm;
15namespace {
16
NAKAMURA Takumie7f03932013-07-16 02:03:32 +000017TEST(TimeValue, time_t) {
Michael J. Spencerf2ca4cb2010-11-24 19:20:05 +000018 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}