blob: 77ff44583ec4d880601926df7d04120915040832 (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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_;
    };
}
 |