diff options
author | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
commit | 24689527cd888aa8a640ecb5077e656b3520d373 (patch) | |
tree | a613ff4cd9567b7113e8376a17f8b85897a42790 /library/cpp/unified_agent_client/clock.h | |
parent | 8642d3642932f03663ba7d2d9670707c192207fd (diff) | |
download | ydb-24689527cd888aa8a640ecb5077e656b3520d373.tar.gz |
Log backend move
Diffstat (limited to 'library/cpp/unified_agent_client/clock.h')
-rw-r--r-- | library/cpp/unified_agent_client/clock.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/library/cpp/unified_agent_client/clock.h b/library/cpp/unified_agent_client/clock.h new file mode 100644 index 0000000000..77ff44583e --- /dev/null +++ b/library/cpp/unified_agent_client/clock.h @@ -0,0 +1,37 @@ +#pragma once + +#include <util/datetime/base.h> + +#include <atomic> + +namespace NUnifiedAgent { + class TClock { + public: + static void Configure(); + + static inline bool Configured() { + return Configured_; + } + + static inline TInstant Now() { + return Configured_ ? Get() : TInstant::Now(); + } + + static void SetBase(TInstant value); + + static void ResetBase(); + + static void ResetBaseWithShift(); + + static void SetShift(TDuration value); + + static void ResetShift(); + + static TInstant Get(); + + private: + static bool Configured_; + static std::atomic<ui64> Base_; + static std::atomic<i64> Shift_; + }; +} |