diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-26 12:19:58 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-26 12:19:58 +0000 |
commit | 58cfb5e88daf7bed3f5b235325eeae5f81983a21 (patch) | |
tree | c5983a05e628d0121078bd76006c651e3c901585 /fastos | |
parent | df25abf6f2498d90498ae2f84643aa1dd61fae9b (diff) |
Avoid the last usages of time(0/NULL/nullptr) in the codebase.
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; |