1 //===-- TimeValue.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_TimeValue_h_
11 #define liblldb_TimeValue_h_
17 // BEGIN: MinGW work around
18 #if !defined(_STRUCT_TIMESPEC) && !defined(HAVE_STRUCT_TIMESPEC)
21 // END: MinGW work around
24 // Other libraries and framework includes
26 #include "lldb/lldb-private.h"
28 namespace lldb_private {
33 static const uint64_t MicroSecPerSec = 1000000UL;
34 static const uint64_t NanoSecPerSec = 1000000000UL;
35 static const uint64_t NanoSecPerMicroSec = 1000U;
37 //------------------------------------------------------------------
38 // Constructors and Destructors
39 //------------------------------------------------------------------
41 TimeValue(const TimeValue& rhs);
42 TimeValue(const struct timespec& ts);
43 TimeValue(const struct timeval& tv);
46 //------------------------------------------------------------------
48 //------------------------------------------------------------------
50 operator=(const TimeValue& rhs);
56 GetAsNanoSecondsSinceJan1_1970() const;
59 GetAsMicroSecondsSinceJan1_1970() const;
62 GetAsSecondsSinceJan1_1970() const;
65 GetAsTimeSpec () const;
68 GetAsTimeVal () const;
74 OffsetWithSeconds (uint64_t sec);
77 OffsetWithMicroSeconds (uint64_t usec);
80 OffsetWithNanoSeconds (uint64_t nsec);
86 Dump (Stream *s, uint32_t width = 0) const;
89 //------------------------------------------------------------------
90 // Classes that inherit from TimeValue can see and modify these
91 //------------------------------------------------------------------
92 uint64_t m_nano_seconds;
95 bool operator == (const TimeValue &lhs, const TimeValue &rhs);
96 bool operator != (const TimeValue &lhs, const TimeValue &rhs);
97 bool operator < (const TimeValue &lhs, const TimeValue &rhs);
98 bool operator <= (const TimeValue &lhs, const TimeValue &rhs);
99 bool operator > (const TimeValue &lhs, const TimeValue &rhs);
100 bool operator >= (const TimeValue &lhs, const TimeValue &rhs);
102 uint64_t operator -(const TimeValue &lhs, const TimeValue &rhs);
104 } // namespace lldb_private
107 #endif // liblldb_TimeValue_h_