diff options
6 files changed, 10 insertions, 17 deletions
diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp index de234a988cd..e35f0c968de 100644 --- a/fastos/src/vespa/fastos/timestamp.cpp +++ b/fastos/src/vespa/fastos/timestamp.cpp @@ -50,14 +50,14 @@ time() { namespace { -int64_t +TimeStamp steady_now() { return duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); } } -int64_t +TimeStamp ClockSteady::now() { return steady_now(); diff --git a/fastos/src/vespa/fastos/timestamp.h b/fastos/src/vespa/fastos/timestamp.h index 300875ed4b8..c418b3aac7d 100644 --- a/fastos/src/vespa/fastos/timestamp.h +++ b/fastos/src/vespa/fastos/timestamp.h @@ -64,7 +64,7 @@ public: class ClockSteady { public: - static int64_t now(); + static TimeStamp now(); }; class StopWatch diff --git a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp index 2826a8da377..13b545e47a6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp @@ -3,9 +3,6 @@ #include <vespa/fastos/timestamp.h> #include <chrono> -using fastos::TimeStamp; -using namespace std::chrono; - namespace proton { using matching::ISessionCachePruner; @@ -19,7 +16,7 @@ PruneSessionCacheJob::PruneSessionCacheJob(ISessionCachePruner &pruner, double j bool PruneSessionCacheJob::run() { - TimeStamp now(duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count()); + fastos::TimeStamp now = fastos::ClockSteady::now(); _pruner.pruneTimedOutSessions(now); return true; } diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 35f5d59bb5f..00f45575d17 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -138,7 +138,7 @@ void AttributeVector::updateStat(bool force) { onUpdateStat(); } else if (_nextStatUpdateTime < fastos::ClockSteady::now()) { onUpdateStat(); - _nextStatUpdateTime = fastos::ClockSteady::now() + 5ul * fastos::TimeStamp::SEC; + _nextStatUpdateTime = fastos::ClockSteady::now() + fastos::TimeStamp(5ul * fastos::TimeStamp::SEC); } } diff --git a/searchlib/src/vespa/searchlib/engine/trace.cpp b/searchlib/src/vespa/searchlib/engine/trace.cpp index d95d07e0e98..576b8dc92a5 100644 --- a/searchlib/src/vespa/searchlib/engine/trace.cpp +++ b/searchlib/src/vespa/searchlib/engine/trace.cpp @@ -3,12 +3,11 @@ #include "trace.h" #include <vespa/vespalib/data/slime/slime.h> -using namespace std::chrono; - namespace search::engine { -fastos::TimeStamp SteadyClock::now() const { - return duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); +fastos::TimeStamp +SteadyClock::now() const { + return fastos::ClockSteady::now(); } RelativeTime::RelativeTime(std::unique_ptr<Clock> clock) diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.cpp b/staging_vespalib/src/vespa/vespalib/util/clock.cpp index 10d075a21bd..543a475480b 100644 --- a/staging_vespalib/src/vespa/vespalib/util/clock.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/clock.cpp @@ -4,9 +4,6 @@ #include <cassert> #include <chrono> -using namespace fastos; -using namespace std::chrono; - namespace vespalib { @@ -28,7 +25,7 @@ Clock::~Clock() void Clock::setTime() const { - _timeNS = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); + _timeNS = fastos::ClockSteady::now(); } void Clock::Run(FastOS_ThreadInterface *thread, void *arguments) @@ -38,7 +35,7 @@ void Clock::Run(FastOS_ThreadInterface *thread, void *arguments) std::unique_lock<std::mutex> guard(_lock); while ( ! thread->GetBreakFlag() && !_stop) { setTime(); - _cond.wait_for(guard, milliseconds(_timePeriodMS)); + _cond.wait_for(guard, std::chrono::milliseconds(_timePeriodMS)); } _running = false; } |