summaryrefslogtreecommitdiff
path: root/include/lldb/Host/TimeValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Host/TimeValue.h')
-rw-r--r--include/lldb/Host/TimeValue.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/include/lldb/Host/TimeValue.h b/include/lldb/Host/TimeValue.h
index 8c43d6d0e5ff..ba230045307f 100644
--- a/include/lldb/Host/TimeValue.h
+++ b/include/lldb/Host/TimeValue.h
@@ -12,6 +12,7 @@
// C Includes
#include <stdint.h>
+#ifndef _MSC_VER
#include <sys/time.h>
// BEGIN: MinGW work around
@@ -19,6 +20,7 @@
#include <pthread.h>
#endif
// END: MinGW work around
+#endif
// C++ Includes
// Other libraries and framework includes
@@ -40,7 +42,7 @@ public:
TimeValue();
TimeValue(const TimeValue& rhs);
TimeValue(const struct timespec& ts);
- TimeValue(const struct timeval& tv);
+ explicit TimeValue(uint32_t seconds, uint32_t nanos = 0);
~TimeValue();
//------------------------------------------------------------------
@@ -64,9 +66,6 @@ public:
struct timespec
GetAsTimeSpec () const;
- struct timeval
- GetAsTimeVal () const;
-
bool
IsValid () const;
@@ -85,6 +84,23 @@ public:
void
Dump (Stream *s, uint32_t width = 0) const;
+ /// Returns only the seconds component of the TimeValue. The nanoseconds
+ /// portion is ignored. No rounding is performed.
+ /// @brief Retrieve the seconds component
+ uint32_t seconds() const { return m_nano_seconds / NanoSecPerSec; }
+
+ /// Returns only the nanoseconds component of the TimeValue. The seconds
+ /// portion is ignored.
+ /// @brief Retrieve the nanoseconds component.
+ uint32_t nanoseconds() const { return m_nano_seconds % NanoSecPerSec; }
+
+ /// Returns only the fractional portion of the TimeValue rounded down to the
+ /// nearest microsecond (divide by one thousand).
+ /// @brief Retrieve the fractional part as microseconds;
+ uint32_t microseconds() const {
+ return (m_nano_seconds % NanoSecPerSec) / NanoSecPerMicroSec;
+ }
+
protected:
//------------------------------------------------------------------
// Classes that inherit from TimeValue can see and modify these