From 58cfb5e88daf7bed3f5b235325eeae5f81983a21 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 26 Aug 2019 12:19:58 +0000 Subject: Avoid the last usages of time(0/NULL/nullptr) in the codebase. --- fastos/src/vespa/fastos/timestamp.cpp | 7 +++++++ fastos/src/vespa/fastos/timestamp.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'fastos') 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 #include #include +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(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 TickStopWatch; typedef TickStopWatch StopWatch; -- cgit v1.2.3