summaryrefslogtreecommitdiffstats
path: root/libnetdutils/include/netdutils
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-05-29 07:29:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-05-29 07:29:24 +0000
commit8fc39b43ac18000c4900aa7b0d3f42fa71eb592c (patch)
tree6423e05ea1791220107283185160a6fcf5111556 /libnetdutils/include/netdutils
parent33a92794a33ceacc5b8f6fbee2b479fb1a1aa831 (diff)
parent196f1b8a0f3d64b02a37069c37b35f32d358939a (diff)
downloadplatform_system_netd-8fc39b43ac18000c4900aa7b0d3f42fa71eb592c.tar.gz
platform_system_netd-8fc39b43ac18000c4900aa7b0d3f42fa71eb592c.tar.bz2
platform_system_netd-8fc39b43ac18000c4900aa7b0d3f42fa71eb592c.zip
Merge "Remove floating-point time functions from StopWatch"
Diffstat (limited to 'libnetdutils/include/netdutils')
-rw-r--r--libnetdutils/include/netdutils/Stopwatch.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/libnetdutils/include/netdutils/Stopwatch.h b/libnetdutils/include/netdutils/Stopwatch.h
index 18e20506e..e7b432645 100644
--- a/libnetdutils/include/netdutils/Stopwatch.h
+++ b/libnetdutils/include/netdutils/Stopwatch.h
@@ -29,22 +29,12 @@ class Stopwatch {
public:
Stopwatch() : mStart(clock::now()) {}
-
virtual ~Stopwatch() = default;
- float timeTaken() const { return getElapsed(clock::now()); }
-
int64_t timeTakenUs() const { return getElapsedUs(clock::now()); }
-
- float getTimeAndReset() {
- const auto& now = clock::now();
- float elapsed = getElapsed(now);
- mStart = now;
- return elapsed;
- }
- float getTimeAndResetUs() {
+ int64_t getTimeAndResetUs() {
const auto& now = clock::now();
- float elapsed = getElapsedUs(now);
+ int64_t elapsed = getElapsedUs(now);
mStart = now;
return elapsed;
}
@@ -52,10 +42,6 @@ class Stopwatch {
private:
time_point mStart;
- float getElapsed(const time_point& now) const {
- using ms = std::chrono::duration<float, std::ratio<1, 1000>>;
- return (std::chrono::duration_cast<ms>(now - mStart)).count();
- }
int64_t getElapsedUs(const time_point& now) const {
return (std::chrono::duration_cast<std::chrono::microseconds>(now - mStart)).count();
}