summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/clock.cpp7
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/clock.h10
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.h2
3 files changed, 10 insertions, 9 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.cpp b/staging_vespalib/src/vespa/vespalib/util/clock.cpp
index c9768417914..10d075a21bd 100644
--- a/staging_vespalib/src/vespa/vespalib/util/clock.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/clock.cpp
@@ -5,6 +5,7 @@
#include <chrono>
using namespace fastos;
+using namespace std::chrono;
namespace vespalib {
@@ -27,7 +28,7 @@ Clock::~Clock()
void Clock::setTime() const
{
- _timeNS = ClockSystem::adjustTick2Sec(ClockSystem::now());
+ _timeNS = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count();
}
void Clock::Run(FastOS_ThreadInterface *thread, void *arguments)
@@ -37,13 +38,13 @@ void Clock::Run(FastOS_ThreadInterface *thread, void *arguments)
std::unique_lock<std::mutex> guard(_lock);
while ( ! thread->GetBreakFlag() && !_stop) {
setTime();
- _cond.wait_for(guard, std::chrono::milliseconds(_timePeriodMS));
+ _cond.wait_for(guard, milliseconds(_timePeriodMS));
}
_running = false;
}
void
-Clock::stop(void)
+Clock::stop()
{
std::lock_guard<std::mutex> guard(_lock);
_stop = true;
diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.h b/staging_vespalib/src/vespa/vespalib/util/clock.h
index 75f407ec95d..b44b1454cd4 100644
--- a/staging_vespalib/src/vespa/vespalib/util/clock.h
+++ b/staging_vespalib/src/vespa/vespalib/util/clock.h
@@ -21,11 +21,11 @@ private:
Clock & operator = (const Clock &);
mutable fastos::TimeStamp _timeNS;
- int _timePeriodMS;
- std::mutex _lock;
- std::condition_variable _cond;
- bool _stop;
- bool _running;
+ int _timePeriodMS;
+ std::mutex _lock;
+ std::condition_variable _cond;
+ bool _stop;
+ bool _running;
void setTime() const;
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.h b/staging_vespalib/src/vespa/vespalib/util/doom.h
index 3b7259f891d..623cc23fcc8 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.h
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.h
@@ -2,7 +2,7 @@
#pragma once
-#include <vespa/vespalib/util/clock.h>
+#include "clock.h"
namespace vespalib {