diff options
author | Derek Mauro <dmauro@google.com> | 2023-04-12 13:26:48 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-12 13:27:28 -0700 |
commit | c23acb9b5636e7b908fba03d6b3584d8f80dba6d (patch) | |
tree | cc2332512cecd0d3efb2f3819516fb6d7af44bc6 /absl/synchronization/internal/kernel_timeout.h | |
parent | 32d314d0f5bb0ca3ff71ece49c71a728c128d43e (diff) | |
download | abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.tar.gz abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.tar.bz2 abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.zip |
Synchronization: Consolidate the logic for whether steady clocks are supported
for relative timeouts
PiperOrigin-RevId: 523789416
Change-Id: Ide4cfdcae9ea7bffca3355c80ea9c8833a9536e6
Diffstat (limited to 'absl/synchronization/internal/kernel_timeout.h')
-rw-r--r-- | absl/synchronization/internal/kernel_timeout.h | 5 |
1 files changed, 5 insertions, 0 deletions
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 |