#include "monotonic_provider.h" namespace NMonotonic { namespace { TIntrusivePtr GlobalMonotonicTimeProvider; } void TMonotonicOperator::RegisterProvider(TIntrusivePtr provider) { GlobalMonotonicTimeProvider = provider; } NMonotonic::TMonotonic TMonotonicOperator::Now() { if (GlobalMonotonicTimeProvider) { return GlobalMonotonicTimeProvider->Now(); } else { return TMonotonic::Now(); } } class TDefaultMonotonicTimeProvider: public IMonotonicTimeProvider { public: TMonotonic Now() override { return TMonotonic::Now(); } }; TIntrusivePtr CreateDefaultMonotonicTimeProvider() { return TIntrusivePtr(new TDefaultMonotonicTimeProvider); } }