summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Hatch <Jeff.Hatch@multitech.com>2018-02-01 07:57:36 -0600
committerJeff Hatch <Jeff.Hatch@multitech.com>2018-02-01 07:57:36 -0600
commitb864bd066393e7a46f42eeffce3e7d3692e7c140 (patch)
treec7a9740e4e5786b8b66b7d97eaa7d757e8a5f3a3 /src
parent0262799be465d36e0b31b9a2af1a9cc709e5ef48 (diff)
downloadlibmts-b864bd066393e7a46f42eeffce3e7d3692e7c140.tar.gz
libmts-b864bd066393e7a46f42eeffce3e7d3692e7c140.tar.bz2
libmts-b864bd066393e7a46f42eeffce3e7d3692e7c140.zip
Add monoTimeMicros() function0.6
Diffstat (limited to 'src')
-rw-r--r--src/MTS_System.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/MTS_System.cpp b/src/MTS_System.cpp
index e1ed348..abed817 100644
--- a/src/MTS_System.cpp
+++ b/src/MTS_System.cpp
@@ -95,6 +95,21 @@ uint64_t System::precisionTimeMicros() {
return micros;
}
+uint64_t System::monoTimeMicros() {
+ uint64_t micros = 0;
+#ifdef WIN32
+ micros = static_cast<uint64_t>(GetTickCount64()) * 1000;
+#else
+ timespec ts;
+ int result = clock_gettime(CLOCK_MONOTONIC, &ts);
+ if (result == 0) {
+ micros = (static_cast<uint64_t>(ts.tv_sec) * 1000000)
+ + (ts.tv_nsec / 1000);
+ }
+#endif
+ return micros;
+}
+
bool System::isBigEndian() {
static union {
uint32_t i;