#ifndef liblldb_TimeValue_h_
#define liblldb_TimeValue_h_
#include <stdint.h>
#include <sys/time.h>
#if !defined(_STRUCT_TIMESPEC) && !defined(HAVE_STRUCT_TIMESPEC)
#include <pthread.h>
#endif
#include "lldb/lldb-private.h"
namespace lldb_private {
class TimeValue
{
public:
static const uint32_t MicroSecPerSec = 1000000UL;
static const uint32_t NanoSecPerSec = 1000000000UL;
static const uint32_t NanoSecPerMicroSec = 1000U;
TimeValue();
TimeValue(const TimeValue& rhs);
TimeValue(const struct timespec& ts);
TimeValue(const struct timeval& tv);
~TimeValue();
const TimeValue&
operator=(const TimeValue& rhs);
void
Clear ();
uint64_t
GetAsNanoSecondsSinceJan1_1970() const;
uint64_t
GetAsMicroSecondsSinceJan1_1970() const;
uint64_t
GetAsSecondsSinceJan1_1970() const;
struct timespec
GetAsTimeSpec () const;
struct timeval
GetAsTimeVal () const;
bool
IsValid () const;
void
OffsetWithSeconds (uint64_t sec);
void
OffsetWithMicroSeconds (uint64_t usec);
void
OffsetWithNanoSeconds (uint64_t nsec);
static TimeValue
Now();
void
Dump (Stream *s, uint32_t width = 0) const;
protected:
uint64_t m_nano_seconds;
};
bool operator == (const TimeValue &lhs, const TimeValue &rhs);
bool operator != (const TimeValue &lhs, const TimeValue &rhs);
bool operator < (const TimeValue &lhs, const TimeValue &rhs);
bool operator <= (const TimeValue &lhs, const TimeValue &rhs);
bool operator > (const TimeValue &lhs, const TimeValue &rhs);
bool operator >= (const TimeValue &lhs, const TimeValue &rhs);
uint64_t operator -(const TimeValue &lhs, const TimeValue &rhs);
}
#endif // liblldb_TimeValue_h_