From c23acb9b5636e7b908fba03d6b3584d8f80dba6d Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Wed, 12 Apr 2023 13:26:48 -0700 Subject: Synchronization: Consolidate the logic for whether steady clocks are supported for relative timeouts PiperOrigin-RevId: 523789416 Change-Id: Ide4cfdcae9ea7bffca3355c80ea9c8833a9536e6 --- absl/synchronization/internal/kernel_timeout.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'absl/synchronization/internal/kernel_timeout.h') diff --git a/absl/synchronization/internal/kernel_timeout.h b/absl/synchronization/internal/kernel_timeout.h index 4e361a6a..06404a75 100644 --- a/absl/synchronization/internal/kernel_timeout.h +++ b/absl/synchronization/internal/kernel_timeout.h @@ -128,6 +128,11 @@ class KernelTimeout { // case of a spurious wakeup. std::chrono::nanoseconds ToChronoDuration() const; + // Returns true if steady (aka monotonic) clocks are supported by the system. + // This method exists because go/btm requires synchronized clocks, and + // thus requires we use the system (aka walltime) clock. + static constexpr bool SupportsSteadyClock() { return true; } + private: // Returns the current time, expressed as a count of nanoseconds since the // epoch used by an arbitrary clock. The implementation tries to use a steady -- cgit v1.2.3