diff options
author | Derek Mauro <dmauro@google.com> | 2023-02-15 07:40:18 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-15 07:41:08 -0800 |
commit | b54044578175b6949fb151b4d8be9153d7093c31 (patch) | |
tree | 414936f548907ab15cc20ec9800928591dc76b44 /absl/synchronization/internal | |
parent | 8aa88cd11caa8dbfd5966e5e2f391b892cfd1c35 (diff) |
KernelTimeout optimization: Use absl::GetCurrentTimeNanos()
instead of absl::ToUnixNanos(absl::Now());
PiperOrigin-RevId: 509829866
Change-Id: Ib34362762304ad6eb7980a1227d717069b84f656
Diffstat (limited to 'absl/synchronization/internal')
-rw-r--r-- | absl/synchronization/internal/kernel_timeout.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/absl/synchronization/internal/kernel_timeout.cc b/absl/synchronization/internal/kernel_timeout.cc index 4015bd0c..8d9e7d74 100644 --- a/absl/synchronization/internal/kernel_timeout.cc +++ b/absl/synchronization/internal/kernel_timeout.cc @@ -89,7 +89,7 @@ int64_t KernelTimeout::MakeAbsNanos() const { int64_t nanos = RawNanos(); if (is_relative_timeout()) { - int64_t now = ToUnixNanos(absl::Now()); + int64_t now = absl::GetCurrentTimeNanos(); if (nanos > kMaxNanos - now) { // Overflow. nanos = kMaxNanos; @@ -118,7 +118,7 @@ struct timespec KernelTimeout::MakeRelativeTimespec() const { } int64_t nanos = RawNanos(); - int64_t now = ToUnixNanos(absl::Now()); + int64_t now = absl::GetCurrentTimeNanos(); if (now > nanos) { // Convert past values to 0 to be safe. nanos = 0; @@ -146,7 +146,7 @@ KernelTimeout::DWord KernelTimeout::InMillisecondsFromNow() const { return static_cast<DWord>(ms); } - int64_t now = ToUnixNanos(absl::Now()); + int64_t now = absl::GetCurrentTimeNanos(); if (nanos >= now) { // Round up so that now + ms_from_now >= nanos. constexpr uint64_t kMaxValueNanos = |