diff options
author | Laszlo Csomor <laszlocsomor@google.com> | 2016-11-07 14:27:21 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-11-08 09:13:05 +0000 |
commit | 943d3cf92648f71c5aa6420aa275e674c82c6a4d (patch) | |
tree | 7b20fc709dc448c0d303d150e7bd4a8cdc0bbb75 /src/main/cpp/blaze_util_freebsd.cc | |
parent | 754a84bbc5c316f99de70e4dbf37b7eb4d6ac4bc (diff) |
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
Diffstat (limited to 'src/main/cpp/blaze_util_freebsd.cc')
-rw-r--r-- | src/main/cpp/blaze_util_freebsd.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/cpp/blaze_util_freebsd.cc b/src/main/cpp/blaze_util_freebsd.cc index d7b7354c71..c4ac11ae93 100644 --- a/src/main/cpp/blaze_util_freebsd.cc +++ b/src/main/cpp/blaze_util_freebsd.cc @@ -86,16 +86,16 @@ string GetSelfPath() { return string(buffer); } -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) { |