diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-15 13:05:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-15 13:05:59 +0000 |
commit | 5e8cbd4cb425a606555f50a14affd37685938c44 (patch) | |
tree | 48cc0efbfb8350ef7e91cc58dc824c3088a0bc38 /vespalib/src | |
parent | 1e1ebc215480ab75e09f3cd7a016bbdf0831c423 (diff) |
Better naming and simpler code.
Diffstat (limited to 'vespalib/src')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/clock.h | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/doom.cpp | 10 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/doom.h | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/vespalib/src/vespa/vespalib/util/clock.h b/vespalib/src/vespa/vespalib/util/clock.h index 967bd07cbd4..1e37e3fff8d 100644 --- a/vespalib/src/vespa/vespalib/util/clock.h +++ b/vespalib/src/vespa/vespalib/util/clock.h @@ -8,7 +8,7 @@ namespace vespalib { /** - * Clock is a clock that updates the time at defined intervals. + * TODO Remove abstraction. Can use atomic ref directly * It is intended used where you want to check the time with low cost, but where * resolution is not that important. */ diff --git a/vespalib/src/vespa/vespalib/util/doom.cpp b/vespalib/src/vespa/vespalib/util/doom.cpp index fa036c0c9c7..8fc82031e79 100644 --- a/vespalib/src/vespa/vespalib/util/doom.cpp +++ b/vespalib/src/vespa/vespalib/util/doom.cpp @@ -5,10 +5,6 @@ namespace vespalib { -namespace { - vespalib::FakeDoom practicallyNeverExpire(std::chrono::hours(24*365*100)); // doom in 100 years -} - Doom::Doom(const Clock &clock, steady_time softDoom, steady_time hardDoom, bool explicitSoftDoom) noexcept : _clock(clock), @@ -17,6 +13,10 @@ Doom::Doom(const Clock &clock, steady_time softDoom, _isExplicitSoftDoom(explicitSoftDoom) { } -const Doom & Doom::armageddon() noexcept { return practicallyNeverExpire.get_doom(); } +const Doom & +Doom::never() noexcept { + static vespalib::FakeDoom neverExpire; + return neverExpire.get_doom(); +} } diff --git a/vespalib/src/vespa/vespalib/util/doom.h b/vespalib/src/vespa/vespalib/util/doom.h index bf9d9343b8c..1d7070cedd0 100644 --- a/vespalib/src/vespa/vespalib/util/doom.h +++ b/vespalib/src/vespa/vespalib/util/doom.h @@ -19,7 +19,7 @@ public: duration soft_left() const noexcept { return _softDoom - _clock.getTimeNS(); } duration hard_left() const noexcept { return _hardDoom - _clock.getTimeNS(); } bool isExplicitSoftDoom() const noexcept { return _isExplicitSoftDoom; } - static const Doom & armageddon() noexcept; + static const Doom & never() noexcept; private: const Clock &_clock; steady_time _softDoom; |