diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-06 19:38:18 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-07 09:50:23 +0200 |
commit | a9ba7645226f200148de44a19aff204dd0841493 (patch) | |
tree | c270f3117048fc8b2ef08c4470232731932f4d05 /fastos/src | |
parent | ece112cf6aadbf135c92f1d5ddada739b290a118 (diff) |
Hide BucketDistribution
Diffstat (limited to 'fastos/src')
-rw-r--r-- | fastos/src/vespa/fastos/time.h | 19 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_time.cpp | 8 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_time.h | 3 |
3 files changed, 14 insertions, 16 deletions
diff --git a/fastos/src/vespa/fastos/time.h b/fastos/src/vespa/fastos/time.h index 97ebe21a3b5..1e37813a072 100644 --- a/fastos/src/vespa/fastos/time.h +++ b/fastos/src/vespa/fastos/time.h @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/types.h> - /** * Interface to OS time functions. */ @@ -12,7 +10,7 @@ protected: /** * Destructor. No cleanup needed for base class. */ - virtual ~FastOS_TimeInterface(void) { } + virtual ~FastOS_TimeInterface() { } public: /** @@ -49,30 +47,26 @@ public: * Note: Only millisecond accuracy is guaranteed. * @param microsecs Number of microseconds to add. */ - void AddMicroSecs(double microsecs) - { SetMicroSecs(MicroSecs() + microsecs); } + void AddMicroSecs(double microsecs) { SetMicroSecs(MicroSecs() + microsecs); } /** * Add a specified number of milliseconds to the time. * @param millisecs Number of milliseconds to add. */ - void AddMilliSecs(double millisecs) - { SetMilliSecs(MilliSecs() + millisecs); } + void AddMilliSecs(double millisecs) { SetMilliSecs(MilliSecs() + millisecs); } /** * Subtract a specified number of microseconds from the time. * Note: Only millisecond accuracy is guaranteed. * @param microsecs Number of microseconds to subtract. */ - void SubtractMicroSecs(double microsecs) - { SetMicroSecs(MicroSecs() - microsecs); } + void SubtractMicroSecs(double microsecs) { SetMicroSecs(MicroSecs() - microsecs); } /** * Subtract a specified number of milliseconds from the time. * @param millisecs Number of milliseconds to subtract. */ - void SubtractMilliSecs(double millisecs) - { SetMilliSecs(MilliSecs() - millisecs); } + void SubtractMilliSecs(double millisecs) { SetMilliSecs(MilliSecs() - millisecs); } /** * Return the time in microseconds. @@ -133,7 +127,6 @@ public: virtual long int GetMicroSeconds() const = 0; }; - #include <vespa/fastos/unix_time.h> -typedef FastOS_UNIX_Time FASTOS_PREFIX(Time); +using FastOS_Time = FastOS_UNIX_Time; diff --git a/fastos/src/vespa/fastos/unix_time.cpp b/fastos/src/vespa/fastos/unix_time.cpp index 202ffe6d82a..6b6a8e58ffb 100644 --- a/fastos/src/vespa/fastos/unix_time.cpp +++ b/fastos/src/vespa/fastos/unix_time.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/time.h> +#include "time.h" +#include "types.h" double FastOS_UNIX_Time::MicroSecs() const @@ -96,3 +97,8 @@ FastOS_UNIX_Time::SetSecs(double secs) _time.tv_usec = - static_cast<int>((- secs - (-_time.tv_sec)) * 1000000); } } + +void FastOS_UNIX_Time::SetNow() { + gettimeofday(&_time, NULL); +} + diff --git a/fastos/src/vespa/fastos/unix_time.h b/fastos/src/vespa/fastos/unix_time.h index dd6122bc463..5ae4916418a 100644 --- a/fastos/src/vespa/fastos/unix_time.h +++ b/fastos/src/vespa/fastos/unix_time.h @@ -89,9 +89,8 @@ public: void SetMilliSecs(double millisecs) override; void SetSecs(double secs) override; - void SetNow() override { gettimeofday(&_time, NULL); } + void SetNow() override; long int GetSeconds() const override { return _time.tv_sec; } long int GetMicroSeconds() const override { return _time.tv_usec; } }; - |