blob: 22937bd87311f8c4538473128d386d27c1b00c89 (
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
|
#include "monotonic_provider.h"
namespace {
TIntrusivePtr<IMonotonicTimeProvider> GlobalMonotonicTimeProvider;
}
void TMonotonicOperator::RegisterProvider(TIntrusivePtr<IMonotonicTimeProvider> provider) {
GlobalMonotonicTimeProvider = provider;
}
NMonotonic::TMonotonic TMonotonicOperator::Now() {
if (GlobalMonotonicTimeProvider) {
return GlobalMonotonicTimeProvider->Now();
} else {
return TMonotonic::Now();
}
}
namespace NMonotonic {
class TDefaultMonotonicTimeProvider: public IMonotonicTimeProvider {
public:
TMonotonic Now() override {
return TMonotonic::Now();
}
};
TIntrusivePtr<IMonotonicTimeProvider> CreateDefaultMonotonicTimeProvider() {
return TIntrusivePtr<IMonotonicTimeProvider>(new TDefaultMonotonicTimeProvider);
}
}
|