C++ refactor: time getters now return milliseconds
Previously they returned nanoseconds but all call
sites converted those to milliseconds.
This is not only a simplification of the semantics
and renaming of the methods to make the returned
units and the purpose clear, but also preparation
for the Windows/MSVC implementations of these
methods.
--
MOS_MIGRATED_REVID=138383956
diff --git a/src/main/cpp/blaze_util_mingw.cc b/src/main/cpp/blaze_util_mingw.cc
index 9136c61..c94ff89 100644
--- a/src/main/cpp/blaze_util_mingw.cc
+++ b/src/main/cpp/blaze_util_mingw.cc
@@ -83,16 +83,16 @@
}
}
-uint64_t MonotonicClock() {
+uint64_t GetMillisecondsMonotonic() {
struct timespec ts = {};
clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts.tv_sec * 1000000000LL + ts.tv_nsec;
+ return ts.tv_sec * 1000LL + (ts.tv_nsec / 1000000LL);
}
-uint64_t ProcessClock() {
+uint64_t GetMillisecondsSinceProcessStart() {
struct timespec ts = {};
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
- return ts.tv_sec * 1000000000LL + ts.tv_nsec;
+ return ts.tv_sec * 1000LL + (ts.tv_nsec / 1000000LL);
}
void SetScheduling(bool batch_cpu_scheduling, int io_nice_level) {