1 //===-- TimeValue.cpp - Implement OS TimeValue Concept ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the operating system TimeValue concept.
12 //===----------------------------------------------------------------------===//
14 #include <llvm/System/TimeValue.h>
19 const TimeValue TimeValue::MinTime = TimeValue ( INT64_MIN,0 );
20 const TimeValue TimeValue::MaxTime = TimeValue ( INT64_MAX,0 );
21 const TimeValue TimeValue::ZeroTime = TimeValue ( 0,0 );
22 const TimeValue TimeValue::PosixZeroTime = TimeValue ( -946684800,0 );
23 const TimeValue TimeValue::Win32ZeroTime = TimeValue ( -12591158400ULL,0 );
26 TimeValue::normalize( void ) {
27 if ( nanos_ >= NANOSECONDS_PER_SECOND ) {
30 nanos_ -= NANOSECONDS_PER_SECOND;
31 } while ( nanos_ >= NANOSECONDS_PER_SECOND );
32 } else if (nanos_ <= -NANOSECONDS_PER_SECOND ) {
35 nanos_ += NANOSECONDS_PER_SECOND;
36 } while (nanos_ <= -NANOSECONDS_PER_SECOND);
39 if (seconds_ >= 1 && nanos_ < 0) {
41 nanos_ += NANOSECONDS_PER_SECOND;
42 } else if (seconds_ < 0 && nanos_ > 0) {
44 nanos_ -= NANOSECONDS_PER_SECOND;
50 /// Include the platform specific portion of TimeValue class
51 #include "platform/TimeValue.cpp"
53 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab