Index: tools/timer/SysTimer_posix.cpp |
diff --git a/tools/timer/SysTimer_posix.cpp b/tools/timer/SysTimer_posix.cpp |
index 4b7d708aab0c4a7e899da8c55ddb409f43845a16..1f05ca9c38aee47899f96b3c16e19aa8e6ccf1d8 100644 |
--- a/tools/timer/SysTimer_posix.cpp |
+++ b/tools/timer/SysTimer_posix.cpp |
@@ -49,3 +49,21 @@ double SysTimer::endWall() { |
} |
return interval_in_ms(fWall, end_wall); |
} |
+ |
+static timespec init_launch_time() { |
+ timespec launchTime; |
+ if (-1 == clock_gettime(CLOCK_MONOTONIC, &launchTime)) { |
+ timespec none = {0, 0}; |
+ return none; |
+ } |
+ return launchTime; |
+}; |
+ |
+double GetTimeMs() { |
+ static const timespec launchTime = init_launch_time(); |
+ timespec now; |
+ if (-1 == clock_gettime(CLOCK_MONOTONIC, &now)) { |
+ return 0; |
+ } |
+ return interval_in_ms(launchTime, now); |
+} |