diff options
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/vespa/fastos/timestamp.cpp | 7 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/timestamp.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp index a662dd32a21..b671aa15b71 100644 --- a/fastos/src/vespa/fastos/timestamp.cpp +++ b/fastos/src/vespa/fastos/timestamp.cpp @@ -1,8 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "timestamp.h" +#include <chrono> #include <cmath> #include <sys/time.h> +using namespace std::chrono; + namespace fastos { const TimeStamp::TimeT TimeStamp::MILLI; @@ -39,4 +42,8 @@ int64_t ClockSystem::now() return ns; } +time_t time() { + return duration_cast<seconds>(system_clock::now().time_since_epoch()).count(); +} + } diff --git a/fastos/src/vespa/fastos/timestamp.h b/fastos/src/vespa/fastos/timestamp.h index 06bf7af922c..c01f93205c0 100644 --- a/fastos/src/vespa/fastos/timestamp.h +++ b/fastos/src/vespa/fastos/timestamp.h @@ -84,6 +84,9 @@ private: TimeStamp _stopTime; }; +time_t time(); + + typedef StopWatchT<ClockSystem> TickStopWatch; typedef TickStopWatch StopWatch; |