aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/time
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-02-10 16:45:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:43 +0300
commit397cbe258b9e064f49c4ca575279f02f39fef76e (patch)
treea0b0eb3cca6a14e4e8ea715393637672fa651284 /contrib/restricted/abseil-cpp-tstring/y_absl/time
parent43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff)
downloadydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/time')
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/.yandex_meta/licenses.list.txt84
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time.cc16
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time/ya.make12
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.cc294
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.h4
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/duration.cc186
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/format.cc86
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/civil_time_detail.h66
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/time_zone.h8
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/zone_info_source.h2
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_format.cc272
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.cc26
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.h2
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.cc268
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.h8
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_libc.cc30
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/tzfile.h4
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/time.cc8
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/time.h80
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/time_zone/ya.make12
-rw-r--r--contrib/restricted/abseil-cpp-tstring/y_absl/time/ya.make24
21 files changed, 746 insertions, 746 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/.yandex_meta/licenses.list.txt b/contrib/restricted/abseil-cpp-tstring/y_absl/time/.yandex_meta/licenses.list.txt
index 7c1bf3b5ad..fda2d3852b 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/.yandex_meta/licenses.list.txt
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/.yandex_meta/licenses.list.txt
@@ -1,42 +1,42 @@
-====================Apache-2.0====================
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-====================Apache-2.0====================
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-====================COPYRIGHT====================
-// Copyright 2016 Google Inc. All Rights Reserved.
-
-
-====================COPYRIGHT====================
-// Copyright 2017 The Abseil Authors.
-
-
-====================COPYRIGHT====================
-// Copyright 2018 The Abseil Authors.
-
-
-====================Public-Domain====================
-** This file is in the public domain, so clarified as of
+====================Apache-2.0====================
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+====================Apache-2.0====================
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+====================COPYRIGHT====================
+// Copyright 2016 Google Inc. All Rights Reserved.
+
+
+====================COPYRIGHT====================
+// Copyright 2017 The Abseil Authors.
+
+
+====================COPYRIGHT====================
+// Copyright 2018 The Abseil Authors.
+
+
+====================Public-Domain====================
+** This file is in the public domain, so clarified as of
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time.cc
index f24bac91e8..ee255126f9 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time.cc
@@ -45,7 +45,7 @@ template <typename CivilT>
bool ParseYearAnd(string_view fmt, string_view s, CivilT* c) {
// Civil times support a larger year range than y_absl::Time, so we need to
// parse the year separately, normalize it, then use y_absl::ParseTime on the
- // normalized string.
+ // normalized string.
const TString ss = TString(s); // TODO(y_absl-team): Avoid conversion.
const char* const np = ss.c_str();
char* endp;
@@ -80,7 +80,7 @@ bool ParseAs(string_view s, CivilT2* c) {
template <typename CivilT>
bool ParseLenient(string_view s, CivilT* c) {
- // A fastpath for when the given string data parses exactly into the given
+ // A fastpath for when the given string data parses exactly into the given
// type T (e.g., s="YYYY-MM-DD" and CivilT=CivilDay).
if (ParseCivilTime(s, c)) return true;
// Try parsing as each of the 6 types, trying the most common types first
@@ -96,26 +96,26 @@ bool ParseLenient(string_view s, CivilT* c) {
} // namespace
TString FormatCivilTime(CivilSecond c) {
- return FormatYearAnd("-%m-%d%ET%H:%M:%S", c);
+ return FormatYearAnd("-%m-%d%ET%H:%M:%S", c);
}
TString FormatCivilTime(CivilMinute c) {
- return FormatYearAnd("-%m-%d%ET%H:%M", c);
+ return FormatYearAnd("-%m-%d%ET%H:%M", c);
}
TString FormatCivilTime(CivilHour c) {
- return FormatYearAnd("-%m-%d%ET%H", c);
+ return FormatYearAnd("-%m-%d%ET%H", c);
}
TString FormatCivilTime(CivilDay c) { return FormatYearAnd("-%m-%d", c); }
TString FormatCivilTime(CivilMonth c) { return FormatYearAnd("-%m", c); }
TString FormatCivilTime(CivilYear c) { return FormatYearAnd("", c); }
bool ParseCivilTime(string_view s, CivilSecond* c) {
- return ParseYearAnd("-%m-%d%ET%H:%M:%S", s, c);
+ return ParseYearAnd("-%m-%d%ET%H:%M:%S", s, c);
}
bool ParseCivilTime(string_view s, CivilMinute* c) {
- return ParseYearAnd("-%m-%d%ET%H:%M", s, c);
+ return ParseYearAnd("-%m-%d%ET%H:%M", s, c);
}
bool ParseCivilTime(string_view s, CivilHour* c) {
- return ParseYearAnd("-%m-%d%ET%H", s, c);
+ return ParseYearAnd("-%m-%d%ET%H", s, c);
}
bool ParseCivilTime(string_view s, CivilDay* c) {
return ParseYearAnd("-%m-%d", s, c);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time/ya.make
index 919773f619..86c47adf5b 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time/ya.make
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/civil_time/ya.make
@@ -2,13 +2,13 @@
LIBRARY()
-WITHOUT_LICENSE_TEXTS()
-
-OWNER(
- somov
- g:cpp-contrib
-)
+WITHOUT_LICENSE_TEXTS()
+OWNER(
+ somov
+ g:cpp-contrib
+)
+
LICENSE(Apache-2.0)
ADDINCL(
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.cc
index dcc12b5633..b4bd38b928 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.cc
@@ -15,7 +15,7 @@
#include "y_absl/time/clock.h"
#include "y_absl/base/attributes.h"
-#include "y_absl/base/optimization.h"
+#include "y_absl/base/optimization.h"
#ifdef _WIN32
#include <windows.h>
@@ -75,7 +75,7 @@ ABSL_NAMESPACE_END
#if !ABSL_USE_CYCLECLOCK_FOR_GET_CURRENT_TIME_NANOS
namespace y_absl {
ABSL_NAMESPACE_BEGIN
-int64_t GetCurrentTimeNanos() { return GET_CURRENT_TIME_NANOS_FROM_SYSTEM(); }
+int64_t GetCurrentTimeNanos() { return GET_CURRENT_TIME_NANOS_FROM_SYSTEM(); }
ABSL_NAMESPACE_END
} // namespace y_absl
#else // Use the cyclecounter-based implementation below.
@@ -152,109 +152,109 @@ static_assert(((kMinNSBetweenSamples << (kScale + 1)) >> (kScale + 1)) ==
// data from a sample of the kernel's time value
struct TimeSampleAtomic {
- std::atomic<uint64_t> raw_ns{0}; // raw kernel time
- std::atomic<uint64_t> base_ns{0}; // our estimate of time
- std::atomic<uint64_t> base_cycles{0}; // cycle counter reading
- std::atomic<uint64_t> nsscaled_per_cycle{0}; // cycle period
+ std::atomic<uint64_t> raw_ns{0}; // raw kernel time
+ std::atomic<uint64_t> base_ns{0}; // our estimate of time
+ std::atomic<uint64_t> base_cycles{0}; // cycle counter reading
+ std::atomic<uint64_t> nsscaled_per_cycle{0}; // cycle period
// cycles before we'll sample again (a scaled reciprocal of the period,
// to avoid a division on the fast path).
- std::atomic<uint64_t> min_cycles_per_sample{0};
+ std::atomic<uint64_t> min_cycles_per_sample{0};
};
// Same again, but with non-atomic types
struct TimeSample {
- uint64_t raw_ns = 0; // raw kernel time
- uint64_t base_ns = 0; // our estimate of time
- uint64_t base_cycles = 0; // cycle counter reading
- uint64_t nsscaled_per_cycle = 0; // cycle period
- uint64_t min_cycles_per_sample = 0; // approx cycles before next sample
+ uint64_t raw_ns = 0; // raw kernel time
+ uint64_t base_ns = 0; // our estimate of time
+ uint64_t base_cycles = 0; // cycle counter reading
+ uint64_t nsscaled_per_cycle = 0; // cycle period
+ uint64_t min_cycles_per_sample = 0; // approx cycles before next sample
};
-struct ABSL_CACHELINE_ALIGNED TimeState {
- std::atomic<uint64_t> seq{0};
- TimeSampleAtomic last_sample; // the last sample; under seq
-
- // The following counters are used only by the test code.
- int64_t stats_initializations{0};
- int64_t stats_reinitializations{0};
- int64_t stats_calibrations{0};
- int64_t stats_slow_paths{0};
- int64_t stats_fast_slow_paths{0};
-
- uint64_t last_now_cycles ABSL_GUARDED_BY(lock){0};
-
- // Used by GetCurrentTimeNanosFromKernel().
- // We try to read clock values at about the same time as the kernel clock.
- // This value gets adjusted up or down as estimate of how long that should
- // take, so we can reject attempts that take unusually long.
- std::atomic<uint64_t> approx_syscall_time_in_cycles{10 * 1000};
- // Number of times in a row we've seen a kernel time call take substantially
- // less than approx_syscall_time_in_cycles.
- std::atomic<uint32_t> kernel_time_seen_smaller{0};
-
- // A reader-writer lock protecting the static locations below.
- // See SeqAcquire() and SeqRelease() above.
- y_absl::base_internal::SpinLock lock{y_absl::kConstInit,
- base_internal::SCHEDULE_KERNEL_ONLY};
-};
-ABSL_CONST_INIT static TimeState time_state{};
-
-// Return the time in ns as told by the kernel interface. Place in *cycleclock
-// the value of the cycleclock at about the time of the syscall.
-// This call represents the time base that this module synchronizes to.
-// Ensures that *cycleclock does not step back by up to (1 << 16) from
-// last_cycleclock, to discard small backward counter steps. (Larger steps are
-// assumed to be complete resyncs, which shouldn't happen. If they do, a full
-// reinitialization of the outer algorithm should occur.)
-static int64_t GetCurrentTimeNanosFromKernel(uint64_t last_cycleclock,
- uint64_t *cycleclock)
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(time_state.lock) {
- uint64_t local_approx_syscall_time_in_cycles = // local copy
- time_state.approx_syscall_time_in_cycles.load(std::memory_order_relaxed);
-
- int64_t current_time_nanos_from_system;
- uint64_t before_cycles;
- uint64_t after_cycles;
- uint64_t elapsed_cycles;
- int loops = 0;
- do {
- before_cycles = GET_CURRENT_TIME_NANOS_CYCLECLOCK_NOW();
- current_time_nanos_from_system = GET_CURRENT_TIME_NANOS_FROM_SYSTEM();
- after_cycles = GET_CURRENT_TIME_NANOS_CYCLECLOCK_NOW();
- // elapsed_cycles is unsigned, so is large on overflow
- elapsed_cycles = after_cycles - before_cycles;
- if (elapsed_cycles >= local_approx_syscall_time_in_cycles &&
- ++loops == 20) { // clock changed frequencies? Back off.
- loops = 0;
- if (local_approx_syscall_time_in_cycles < 1000 * 1000) {
- local_approx_syscall_time_in_cycles =
- (local_approx_syscall_time_in_cycles + 1) << 1;
- }
- time_state.approx_syscall_time_in_cycles.store(
- local_approx_syscall_time_in_cycles, std::memory_order_relaxed);
- }
- } while (elapsed_cycles >= local_approx_syscall_time_in_cycles ||
- last_cycleclock - after_cycles < (static_cast<uint64_t>(1) << 16));
-
- // Adjust approx_syscall_time_in_cycles to be within a factor of 2
- // of the typical time to execute one iteration of the loop above.
- if ((local_approx_syscall_time_in_cycles >> 1) < elapsed_cycles) {
- // measured time is no smaller than half current approximation
- time_state.kernel_time_seen_smaller.store(0, std::memory_order_relaxed);
- } else if (time_state.kernel_time_seen_smaller.fetch_add(
- 1, std::memory_order_relaxed) >= 3) {
- // smaller delays several times in a row; reduce approximation by 12.5%
- const uint64_t new_approximation =
- local_approx_syscall_time_in_cycles -
- (local_approx_syscall_time_in_cycles >> 3);
- time_state.approx_syscall_time_in_cycles.store(new_approximation,
- std::memory_order_relaxed);
- time_state.kernel_time_seen_smaller.store(0, std::memory_order_relaxed);
- }
-
- *cycleclock = after_cycles;
- return current_time_nanos_from_system;
-}
-
+struct ABSL_CACHELINE_ALIGNED TimeState {
+ std::atomic<uint64_t> seq{0};
+ TimeSampleAtomic last_sample; // the last sample; under seq
+
+ // The following counters are used only by the test code.
+ int64_t stats_initializations{0};
+ int64_t stats_reinitializations{0};
+ int64_t stats_calibrations{0};
+ int64_t stats_slow_paths{0};
+ int64_t stats_fast_slow_paths{0};
+
+ uint64_t last_now_cycles ABSL_GUARDED_BY(lock){0};
+
+ // Used by GetCurrentTimeNanosFromKernel().
+ // We try to read clock values at about the same time as the kernel clock.
+ // This value gets adjusted up or down as estimate of how long that should
+ // take, so we can reject attempts that take unusually long.
+ std::atomic<uint64_t> approx_syscall_time_in_cycles{10 * 1000};
+ // Number of times in a row we've seen a kernel time call take substantially
+ // less than approx_syscall_time_in_cycles.
+ std::atomic<uint32_t> kernel_time_seen_smaller{0};
+
+ // A reader-writer lock protecting the static locations below.
+ // See SeqAcquire() and SeqRelease() above.
+ y_absl::base_internal::SpinLock lock{y_absl::kConstInit,
+ base_internal::SCHEDULE_KERNEL_ONLY};
+};
+ABSL_CONST_INIT static TimeState time_state{};
+
+// Return the time in ns as told by the kernel interface. Place in *cycleclock
+// the value of the cycleclock at about the time of the syscall.
+// This call represents the time base that this module synchronizes to.
+// Ensures that *cycleclock does not step back by up to (1 << 16) from
+// last_cycleclock, to discard small backward counter steps. (Larger steps are
+// assumed to be complete resyncs, which shouldn't happen. If they do, a full
+// reinitialization of the outer algorithm should occur.)
+static int64_t GetCurrentTimeNanosFromKernel(uint64_t last_cycleclock,
+ uint64_t *cycleclock)
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(time_state.lock) {
+ uint64_t local_approx_syscall_time_in_cycles = // local copy
+ time_state.approx_syscall_time_in_cycles.load(std::memory_order_relaxed);
+
+ int64_t current_time_nanos_from_system;
+ uint64_t before_cycles;
+ uint64_t after_cycles;
+ uint64_t elapsed_cycles;
+ int loops = 0;
+ do {
+ before_cycles = GET_CURRENT_TIME_NANOS_CYCLECLOCK_NOW();
+ current_time_nanos_from_system = GET_CURRENT_TIME_NANOS_FROM_SYSTEM();
+ after_cycles = GET_CURRENT_TIME_NANOS_CYCLECLOCK_NOW();
+ // elapsed_cycles is unsigned, so is large on overflow
+ elapsed_cycles = after_cycles - before_cycles;
+ if (elapsed_cycles >= local_approx_syscall_time_in_cycles &&
+ ++loops == 20) { // clock changed frequencies? Back off.
+ loops = 0;
+ if (local_approx_syscall_time_in_cycles < 1000 * 1000) {
+ local_approx_syscall_time_in_cycles =
+ (local_approx_syscall_time_in_cycles + 1) << 1;
+ }
+ time_state.approx_syscall_time_in_cycles.store(
+ local_approx_syscall_time_in_cycles, std::memory_order_relaxed);
+ }
+ } while (elapsed_cycles >= local_approx_syscall_time_in_cycles ||
+ last_cycleclock - after_cycles < (static_cast<uint64_t>(1) << 16));
+
+ // Adjust approx_syscall_time_in_cycles to be within a factor of 2
+ // of the typical time to execute one iteration of the loop above.
+ if ((local_approx_syscall_time_in_cycles >> 1) < elapsed_cycles) {
+ // measured time is no smaller than half current approximation
+ time_state.kernel_time_seen_smaller.store(0, std::memory_order_relaxed);
+ } else if (time_state.kernel_time_seen_smaller.fetch_add(
+ 1, std::memory_order_relaxed) >= 3) {
+ // smaller delays several times in a row; reduce approximation by 12.5%
+ const uint64_t new_approximation =
+ local_approx_syscall_time_in_cycles -
+ (local_approx_syscall_time_in_cycles >> 3);
+ time_state.approx_syscall_time_in_cycles.store(new_approximation,
+ std::memory_order_relaxed);
+ time_state.kernel_time_seen_smaller.store(0, std::memory_order_relaxed);
+ }
+
+ *cycleclock = after_cycles;
+ return current_time_nanos_from_system;
+}
+
static int64_t GetCurrentTimeNanosSlowPath() ABSL_ATTRIBUTE_COLD;
// Read the contents of *atomic into *sample.
@@ -321,15 +321,15 @@ int64_t GetCurrentTimeNanos() {
// Acquire pairs with the barrier in SeqRelease - if this load sees that
// store, the shared-data reads necessarily see that SeqRelease's updates
// to the same shared data.
- seq_read0 = time_state.seq.load(std::memory_order_acquire);
+ seq_read0 = time_state.seq.load(std::memory_order_acquire);
- base_ns = time_state.last_sample.base_ns.load(std::memory_order_relaxed);
- base_cycles =
- time_state.last_sample.base_cycles.load(std::memory_order_relaxed);
+ base_ns = time_state.last_sample.base_ns.load(std::memory_order_relaxed);
+ base_cycles =
+ time_state.last_sample.base_cycles.load(std::memory_order_relaxed);
nsscaled_per_cycle =
- time_state.last_sample.nsscaled_per_cycle.load(std::memory_order_relaxed);
- min_cycles_per_sample = time_state.last_sample.min_cycles_per_sample.load(
- std::memory_order_relaxed);
+ time_state.last_sample.nsscaled_per_cycle.load(std::memory_order_relaxed);
+ min_cycles_per_sample = time_state.last_sample.min_cycles_per_sample.load(
+ std::memory_order_relaxed);
// This acquire fence pairs with the release fence in SeqAcquire. Since it
// is sequenced between reads of shared data and seq_read1, the reads of
@@ -340,7 +340,7 @@ int64_t GetCurrentTimeNanos() {
// shared-data writes are effectively release ordered. Therefore if our
// shared-data reads see any of a particular update's shared-data writes,
// seq_read1 is guaranteed to see that update's SeqAcquire.
- seq_read1 = time_state.seq.load(std::memory_order_relaxed);
+ seq_read1 = time_state.seq.load(std::memory_order_relaxed);
// Fast path. Return if min_cycles_per_sample has not yet elapsed since the
// last sample, and we read a consistent sample. The fast path activates
@@ -353,9 +353,9 @@ int64_t GetCurrentTimeNanos() {
// last_sample was updated). This is harmless, because delta_cycles will wrap
// and report a time much much bigger than min_cycles_per_sample. In that case
// we will take the slow path.
- uint64_t delta_cycles;
+ uint64_t delta_cycles;
if (seq_read0 == seq_read1 && (seq_read0 & 1) == 0 &&
- (delta_cycles = now_cycles - base_cycles) < min_cycles_per_sample) {
+ (delta_cycles = now_cycles - base_cycles) < min_cycles_per_sample) {
return base_ns + ((delta_cycles * nsscaled_per_cycle) >> kScale);
}
return GetCurrentTimeNanosSlowPath();
@@ -395,25 +395,25 @@ static uint64_t UpdateLastSample(
// TODO(y_absl-team): Remove this attribute when our compiler is smart enough
// to do the right thing.
ABSL_ATTRIBUTE_NOINLINE
-static int64_t GetCurrentTimeNanosSlowPath()
- ABSL_LOCKS_EXCLUDED(time_state.lock) {
+static int64_t GetCurrentTimeNanosSlowPath()
+ ABSL_LOCKS_EXCLUDED(time_state.lock) {
// Serialize access to slow-path. Fast-path readers are not blocked yet, and
// code below must not modify last_sample until the seqlock is acquired.
- time_state.lock.Lock();
+ time_state.lock.Lock();
// Sample the kernel time base. This is the definition of
// "now" if we take the slow path.
uint64_t now_cycles;
- uint64_t now_ns =
- GetCurrentTimeNanosFromKernel(time_state.last_now_cycles, &now_cycles);
- time_state.last_now_cycles = now_cycles;
+ uint64_t now_ns =
+ GetCurrentTimeNanosFromKernel(time_state.last_now_cycles, &now_cycles);
+ time_state.last_now_cycles = now_cycles;
uint64_t estimated_base_ns;
// ----------
// Read the "last_sample" values again; this time holding the write lock.
struct TimeSample sample;
- ReadTimeSampleAtomic(&time_state.last_sample, &sample);
+ ReadTimeSampleAtomic(&time_state.last_sample, &sample);
// ----------
// Try running the fast path again; another thread may have updated the
@@ -424,13 +424,13 @@ static int64_t GetCurrentTimeNanosSlowPath()
// so that blocked readers can make progress without blocking new readers.
estimated_base_ns = sample.base_ns +
((delta_cycles * sample.nsscaled_per_cycle) >> kScale);
- time_state.stats_fast_slow_paths++;
+ time_state.stats_fast_slow_paths++;
} else {
estimated_base_ns =
UpdateLastSample(now_cycles, now_ns, delta_cycles, &sample);
}
- time_state.lock.Unlock();
+ time_state.lock.Unlock();
return estimated_base_ns;
}
@@ -441,10 +441,10 @@ static int64_t GetCurrentTimeNanosSlowPath()
static uint64_t UpdateLastSample(uint64_t now_cycles, uint64_t now_ns,
uint64_t delta_cycles,
const struct TimeSample *sample)
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(time_state.lock) {
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(time_state.lock) {
uint64_t estimated_base_ns = now_ns;
- uint64_t lock_value =
- SeqAcquire(&time_state.seq); // acquire seqlock to block readers
+ uint64_t lock_value =
+ SeqAcquire(&time_state.seq); // acquire seqlock to block readers
// The 5s in the next if-statement limits the time for which we will trust
// the cycle counter and our last sample to give a reasonable result.
@@ -454,16 +454,16 @@ static uint64_t UpdateLastSample(uint64_t now_cycles, uint64_t now_ns,
sample->raw_ns + static_cast<uint64_t>(5) * 1000 * 1000 * 1000 < now_ns ||
now_ns < sample->raw_ns || now_cycles < sample->base_cycles) {
// record this sample, and forget any previously known slope.
- time_state.last_sample.raw_ns.store(now_ns, std::memory_order_relaxed);
- time_state.last_sample.base_ns.store(estimated_base_ns,
- std::memory_order_relaxed);
- time_state.last_sample.base_cycles.store(now_cycles,
- std::memory_order_relaxed);
- time_state.last_sample.nsscaled_per_cycle.store(0,
- std::memory_order_relaxed);
- time_state.last_sample.min_cycles_per_sample.store(
- 0, std::memory_order_relaxed);
- time_state.stats_initializations++;
+ time_state.last_sample.raw_ns.store(now_ns, std::memory_order_relaxed);
+ time_state.last_sample.base_ns.store(estimated_base_ns,
+ std::memory_order_relaxed);
+ time_state.last_sample.base_cycles.store(now_cycles,
+ std::memory_order_relaxed);
+ time_state.last_sample.nsscaled_per_cycle.store(0,
+ std::memory_order_relaxed);
+ time_state.last_sample.min_cycles_per_sample.store(
+ 0, std::memory_order_relaxed);
+ time_state.stats_initializations++;
} else if (sample->raw_ns + 500 * 1000 * 1000 < now_ns &&
sample->base_cycles + 50 < now_cycles) {
// Enough time has passed to compute the cycle time.
@@ -506,32 +506,32 @@ static uint64_t UpdateLastSample(uint64_t now_cycles, uint64_t now_ns,
if (new_nsscaled_per_cycle != 0 &&
diff_ns < 100 * 1000 * 1000 && -diff_ns < 100 * 1000 * 1000) {
// record the cycle time measurement
- time_state.last_sample.nsscaled_per_cycle.store(
+ time_state.last_sample.nsscaled_per_cycle.store(
new_nsscaled_per_cycle, std::memory_order_relaxed);
uint64_t new_min_cycles_per_sample =
SafeDivideAndScale(kMinNSBetweenSamples, new_nsscaled_per_cycle);
- time_state.last_sample.min_cycles_per_sample.store(
+ time_state.last_sample.min_cycles_per_sample.store(
new_min_cycles_per_sample, std::memory_order_relaxed);
- time_state.stats_calibrations++;
+ time_state.stats_calibrations++;
} else { // something went wrong; forget the slope
- time_state.last_sample.nsscaled_per_cycle.store(
- 0, std::memory_order_relaxed);
- time_state.last_sample.min_cycles_per_sample.store(
- 0, std::memory_order_relaxed);
+ time_state.last_sample.nsscaled_per_cycle.store(
+ 0, std::memory_order_relaxed);
+ time_state.last_sample.min_cycles_per_sample.store(
+ 0, std::memory_order_relaxed);
estimated_base_ns = now_ns;
- time_state.stats_reinitializations++;
+ time_state.stats_reinitializations++;
}
- time_state.last_sample.raw_ns.store(now_ns, std::memory_order_relaxed);
- time_state.last_sample.base_ns.store(estimated_base_ns,
- std::memory_order_relaxed);
- time_state.last_sample.base_cycles.store(now_cycles,
- std::memory_order_relaxed);
+ time_state.last_sample.raw_ns.store(now_ns, std::memory_order_relaxed);
+ time_state.last_sample.base_ns.store(estimated_base_ns,
+ std::memory_order_relaxed);
+ time_state.last_sample.base_cycles.store(now_cycles,
+ std::memory_order_relaxed);
} else {
// have a sample, but no slope; waiting for enough time for a calibration
- time_state.stats_slow_paths++;
+ time_state.stats_slow_paths++;
}
- SeqRelease(&time_state.seq, lock_value); // release the readers
+ SeqRelease(&time_state.seq, lock_value); // release the readers
return estimated_base_ns;
}
@@ -573,8 +573,8 @@ ABSL_NAMESPACE_END
extern "C" {
-ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(
- y_absl::Duration duration) {
+ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(
+ y_absl::Duration duration) {
while (duration > y_absl::ZeroDuration()) {
y_absl::Duration to_sleep = std::min(duration, y_absl::MaxSleep());
y_absl::SleepOnce(to_sleep);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.h
index 178b96d828..1743884e8c 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/clock.h
@@ -64,11 +64,11 @@ ABSL_NAMESPACE_END
// By changing our extension points to be extern "C", we dodge this
// check.
extern "C" {
-void ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(y_absl::Duration duration);
+void ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(y_absl::Duration duration);
} // extern "C"
inline void y_absl::SleepFor(y_absl::Duration duration) {
- ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(duration);
+ ABSL_INTERNAL_C_SYMBOL(AbslInternalSleepFor)(duration);
}
#endif // ABSL_TIME_CLOCK_H_
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/duration.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/duration.cc
index d4914556e6..cf1e9ad038 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/duration.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/duration.cc
@@ -67,10 +67,10 @@
#include <util/generic/string.h>
#include "y_absl/base/casts.h"
-#include "y_absl/base/macros.h"
+#include "y_absl/base/macros.h"
#include "y_absl/numeric/int128.h"
-#include "y_absl/strings/string_view.h"
-#include "y_absl/strings/strip.h"
+#include "y_absl/strings/string_view.h"
+#include "y_absl/strings/strip.h"
#include "y_absl/time/time.h"
namespace y_absl {
@@ -356,7 +356,7 @@ namespace time_internal {
// the remainder. If it does not saturate, the remainder remain accurate,
// but the returned quotient will over/underflow int64_t and should not be used.
int64_t IDivDuration(bool satq, const Duration num, const Duration den,
- Duration* rem) {
+ Duration* rem) {
int64_t q = 0;
if (IDivFastPath(num, den, &q, rem)) {
return q;
@@ -711,17 +711,17 @@ char* Format64(char* ep, int width, int64_t v) {
// fractional digits, because it is in the noise of what a Duration can
// represent.
struct DisplayUnit {
- y_absl::string_view abbr;
+ y_absl::string_view abbr;
int prec;
double pow10;
};
-ABSL_CONST_INIT const DisplayUnit kDisplayNano = {"ns", 2, 1e2};
-ABSL_CONST_INIT const DisplayUnit kDisplayMicro = {"us", 5, 1e5};
-ABSL_CONST_INIT const DisplayUnit kDisplayMilli = {"ms", 8, 1e8};
-ABSL_CONST_INIT const DisplayUnit kDisplaySec = {"s", 11, 1e11};
-ABSL_CONST_INIT const DisplayUnit kDisplayMin = {"m", -1, 0.0}; // prec ignored
-ABSL_CONST_INIT const DisplayUnit kDisplayHour = {"h", -1,
- 0.0}; // prec ignored
+ABSL_CONST_INIT const DisplayUnit kDisplayNano = {"ns", 2, 1e2};
+ABSL_CONST_INIT const DisplayUnit kDisplayMicro = {"us", 5, 1e5};
+ABSL_CONST_INIT const DisplayUnit kDisplayMilli = {"ms", 8, 1e8};
+ABSL_CONST_INIT const DisplayUnit kDisplaySec = {"s", 11, 1e11};
+ABSL_CONST_INIT const DisplayUnit kDisplayMin = {"m", -1, 0.0}; // prec ignored
+ABSL_CONST_INIT const DisplayUnit kDisplayHour = {"h", -1,
+ 0.0}; // prec ignored
void AppendNumberUnit(TString* out, int64_t n, DisplayUnit unit) {
char buf[sizeof("2562047788015216")]; // hours in max duration
@@ -729,16 +729,16 @@ void AppendNumberUnit(TString* out, int64_t n, DisplayUnit unit) {
char* bp = Format64(ep, 0, n);
if (*bp != '0' || bp + 1 != ep) {
out->append(bp, ep - bp);
- out->append(unit.abbr.data(), unit.abbr.size());
+ out->append(unit.abbr.data(), unit.abbr.size());
}
}
// Note: unit.prec is limited to double's digits10 value (typically 15) so it
// always fits in buf[].
void AppendNumberUnit(TString* out, double n, DisplayUnit unit) {
- constexpr int kBufferSize = std::numeric_limits<double>::digits10;
- const int prec = std::min(kBufferSize, unit.prec);
- char buf[kBufferSize]; // also large enough to hold integer part
+ constexpr int kBufferSize = std::numeric_limits<double>::digits10;
+ const int prec = std::min(kBufferSize, unit.prec);
+ char buf[kBufferSize]; // also large enough to hold integer part
char* ep = buf + sizeof(buf);
double d = 0;
int64_t frac_part = Round(std::modf(n, &d) * unit.pow10);
@@ -752,7 +752,7 @@ void AppendNumberUnit(TString* out, double n, DisplayUnit unit) {
while (ep[-1] == '0') --ep;
out->append(bp, ep - bp);
}
- out->append(unit.abbr.data(), unit.abbr.size());
+ out->append(unit.abbr.data(), unit.abbr.size());
}
}
@@ -763,8 +763,8 @@ void AppendNumberUnit(TString* out, double n, DisplayUnit unit) {
// form "72h3m0.5s". Leading zero units are omitted. As a special
// case, durations less than one second format use a smaller unit
// (milli-, micro-, or nanoseconds) to ensure that the leading digit
-// is non-zero.
-// Unlike Go, we format the zero duration as 0, with no unit.
+// is non-zero.
+// Unlike Go, we format the zero duration as 0, with no unit.
TString FormatDuration(Duration d) {
const Duration min_duration = Seconds(kint64min);
if (d == min_duration) {
@@ -805,27 +805,27 @@ namespace {
// A helper for ParseDuration() that parses a leading number from the given
// string and stores the result in *int_part/*frac_part/*frac_scale. The
// given string pointer is modified to point to the first unconsumed char.
-bool ConsumeDurationNumber(const char** dpp, const char* ep, int64_t* int_part,
+bool ConsumeDurationNumber(const char** dpp, const char* ep, int64_t* int_part,
int64_t* frac_part, int64_t* frac_scale) {
*int_part = 0;
*frac_part = 0;
*frac_scale = 1; // invariant: *frac_part < *frac_scale
const char* start = *dpp;
- for (; *dpp != ep; *dpp += 1) {
+ for (; *dpp != ep; *dpp += 1) {
const int d = **dpp - '0'; // contiguous digits
- if (d < 0 || 10 <= d) break;
-
+ if (d < 0 || 10 <= d) break;
+
if (*int_part > kint64max / 10) return false;
*int_part *= 10;
if (*int_part > kint64max - d) return false;
*int_part += d;
}
const bool int_part_empty = (*dpp == start);
- if (*dpp == ep || **dpp != '.') return !int_part_empty;
-
- for (*dpp += 1; *dpp != ep; *dpp += 1) {
+ if (*dpp == ep || **dpp != '.') return !int_part_empty;
+
+ for (*dpp += 1; *dpp != ep; *dpp += 1) {
const int d = **dpp - '0'; // contiguous digits
- if (d < 0 || 10 <= d) break;
+ if (d < 0 || 10 <= d) break;
if (*frac_scale <= kint64max / 10) {
*frac_part *= 10;
*frac_part += d;
@@ -839,55 +839,55 @@ bool ConsumeDurationNumber(const char** dpp, const char* ep, int64_t* int_part,
// ns, us, ms, s, m, h) from the given string and stores the resulting unit
// in "*unit". The given string pointer is modified to point to the first
// unconsumed char.
-bool ConsumeDurationUnit(const char** start, const char* end, Duration* unit) {
- size_t size = end - *start;
- switch (size) {
- case 0:
- return false;
- default:
- switch (**start) {
- case 'n':
- if (*(*start + 1) == 's') {
- *start += 2;
- *unit = Nanoseconds(1);
- return true;
- }
- break;
- case 'u':
- if (*(*start + 1) == 's') {
- *start += 2;
- *unit = Microseconds(1);
- return true;
- }
- break;
- case 'm':
- if (*(*start + 1) == 's') {
- *start += 2;
- *unit = Milliseconds(1);
- return true;
- }
- break;
- default:
- break;
- }
- ABSL_FALLTHROUGH_INTENDED;
- case 1:
- switch (**start) {
- case 's':
- *unit = Seconds(1);
- *start += 1;
- return true;
- case 'm':
- *unit = Minutes(1);
- *start += 1;
- return true;
- case 'h':
- *unit = Hours(1);
- *start += 1;
- return true;
- default:
- return false;
- }
+bool ConsumeDurationUnit(const char** start, const char* end, Duration* unit) {
+ size_t size = end - *start;
+ switch (size) {
+ case 0:
+ return false;
+ default:
+ switch (**start) {
+ case 'n':
+ if (*(*start + 1) == 's') {
+ *start += 2;
+ *unit = Nanoseconds(1);
+ return true;
+ }
+ break;
+ case 'u':
+ if (*(*start + 1) == 's') {
+ *start += 2;
+ *unit = Microseconds(1);
+ return true;
+ }
+ break;
+ case 'm':
+ if (*(*start + 1) == 's') {
+ *start += 2;
+ *unit = Milliseconds(1);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ ABSL_FALLTHROUGH_INTENDED;
+ case 1:
+ switch (**start) {
+ case 's':
+ *unit = Seconds(1);
+ *start += 1;
+ return true;
+ case 'm':
+ *unit = Minutes(1);
+ *start += 1;
+ return true;
+ case 'h':
+ *unit = Hours(1);
+ *start += 1;
+ return true;
+ default:
+ return false;
+ }
}
}
@@ -898,38 +898,38 @@ bool ConsumeDurationUnit(const char** start, const char* end, Duration* unit) {
// a possibly signed sequence of decimal numbers, each with optional
// fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".
// Valid time units are "ns", "us" "ms", "s", "m", "h".
-bool ParseDuration(y_absl::string_view dur_sv, Duration* d) {
+bool ParseDuration(y_absl::string_view dur_sv, Duration* d) {
int sign = 1;
- if (y_absl::ConsumePrefix(&dur_sv, "-")) {
- sign = -1;
- } else {
- y_absl::ConsumePrefix(&dur_sv, "+");
+ if (y_absl::ConsumePrefix(&dur_sv, "-")) {
+ sign = -1;
+ } else {
+ y_absl::ConsumePrefix(&dur_sv, "+");
}
- if (dur_sv.empty()) return false;
+ if (dur_sv.empty()) return false;
- // Special case for a string of "0".
- if (dur_sv == "0") {
+ // Special case for a string of "0".
+ if (dur_sv == "0") {
*d = ZeroDuration();
return true;
}
- if (dur_sv == "inf") {
+ if (dur_sv == "inf") {
*d = sign * InfiniteDuration();
return true;
}
- const char* start = dur_sv.data();
- const char* end = start + dur_sv.size();
-
+ const char* start = dur_sv.data();
+ const char* end = start + dur_sv.size();
+
Duration dur;
- while (start != end) {
+ while (start != end) {
int64_t int_part;
int64_t frac_part;
int64_t frac_scale;
Duration unit;
- if (!ConsumeDurationNumber(&start, end, &int_part, &frac_part,
- &frac_scale) ||
- !ConsumeDurationUnit(&start, end, &unit)) {
+ if (!ConsumeDurationNumber(&start, end, &int_part, &frac_part,
+ &frac_scale) ||
+ !ConsumeDurationUnit(&start, end, &unit)) {
return false;
}
if (int_part != 0) dur += sign * int_part * unit;
@@ -940,7 +940,7 @@ bool ParseDuration(y_absl::string_view dur_sv, Duration* d) {
}
bool AbslParseFlag(y_absl::string_view text, Duration* dst, TString*) {
- return ParseDuration(text, dst);
+ return ParseDuration(text, dst);
}
TString AbslUnparseFlag(Duration d) { return FormatDuration(d); }
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/format.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/format.cc
index c75e4ec21a..ee62b6e3b2 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/format.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/format.cc
@@ -13,12 +13,12 @@
// limitations under the License.
#include <string.h>
-
+
#include <cctype>
#include <cstdint>
-#include "y_absl/strings/match.h"
-#include "y_absl/strings/string_view.h"
+#include "y_absl/strings/match.h"
+#include "y_absl/strings/string_view.h"
#include "y_absl/time/internal/cctz/include/cctz/time_zone.h"
#include "y_absl/time/time.h"
@@ -27,11 +27,11 @@ namespace cctz = y_absl::time_internal::cctz;
namespace y_absl {
ABSL_NAMESPACE_BEGIN
-ABSL_DLL extern const char RFC3339_full[] = "%Y-%m-%d%ET%H:%M:%E*S%Ez";
-ABSL_DLL extern const char RFC3339_sec[] = "%Y-%m-%d%ET%H:%M:%S%Ez";
+ABSL_DLL extern const char RFC3339_full[] = "%Y-%m-%d%ET%H:%M:%E*S%Ez";
+ABSL_DLL extern const char RFC3339_sec[] = "%Y-%m-%d%ET%H:%M:%S%Ez";
-ABSL_DLL extern const char RFC1123_full[] = "%a, %d %b %E4Y %H:%M:%S %z";
-ABSL_DLL extern const char RFC1123_no_wday[] = "%d %b %E4Y %H:%M:%S %z";
+ABSL_DLL extern const char RFC1123_full[] = "%a, %d %b %E4Y %H:%M:%S %z";
+ABSL_DLL extern const char RFC1123_no_wday[] = "%d %b %E4Y %H:%M:%S %z";
namespace {
@@ -71,12 +71,12 @@ y_absl::Time Join(const cctz_parts& parts) {
} // namespace
-TString FormatTime(y_absl::string_view format, y_absl::Time t,
+TString FormatTime(y_absl::string_view format, y_absl::Time t,
y_absl::TimeZone tz) {
- if (t == y_absl::InfiniteFuture()) return TString(kInfiniteFutureStr);
- if (t == y_absl::InfinitePast()) return TString(kInfinitePastStr);
+ if (t == y_absl::InfiniteFuture()) return TString(kInfiniteFutureStr);
+ if (t == y_absl::InfinitePast()) return TString(kInfinitePastStr);
const auto parts = Split(t);
- return cctz::detail::format(TString(format), parts.sec, parts.fem,
+ return cctz::detail::format(TString(format), parts.sec, parts.fem,
cctz::time_zone(tz));
}
@@ -88,50 +88,50 @@ TString FormatTime(y_absl::Time t) {
return y_absl::FormatTime(RFC3339_full, t, y_absl::LocalTimeZone());
}
-bool ParseTime(y_absl::string_view format, y_absl::string_view input,
+bool ParseTime(y_absl::string_view format, y_absl::string_view input,
y_absl::Time* time, TString* err) {
return y_absl::ParseTime(format, input, y_absl::UTCTimeZone(), time, err);
}
// If the input string does not contain an explicit UTC offset, interpret
// the fields with respect to the given TimeZone.
-bool ParseTime(y_absl::string_view format, y_absl::string_view input,
+bool ParseTime(y_absl::string_view format, y_absl::string_view input,
y_absl::TimeZone tz, y_absl::Time* time, TString* err) {
- auto strip_leading_space = [](y_absl::string_view* sv) {
- while (!sv->empty()) {
- if (!std::isspace(sv->front())) return;
- sv->remove_prefix(1);
+ auto strip_leading_space = [](y_absl::string_view* sv) {
+ while (!sv->empty()) {
+ if (!std::isspace(sv->front())) return;
+ sv->remove_prefix(1);
}
- };
-
- // Portable toolchains means we don't get nice constexpr here.
- struct Literal {
- const char* name;
- size_t size;
- y_absl::Time value;
- };
- static Literal literals[] = {
- {kInfiniteFutureStr, strlen(kInfiniteFutureStr), InfiniteFuture()},
- {kInfinitePastStr, strlen(kInfinitePastStr), InfinitePast()},
- };
- strip_leading_space(&input);
- for (const auto& lit : literals) {
- if (y_absl::StartsWith(input, y_absl::string_view(lit.name, lit.size))) {
- y_absl::string_view tail = input;
- tail.remove_prefix(lit.size);
- strip_leading_space(&tail);
- if (tail.empty()) {
- *time = lit.value;
- return true;
- }
+ };
+
+ // Portable toolchains means we don't get nice constexpr here.
+ struct Literal {
+ const char* name;
+ size_t size;
+ y_absl::Time value;
+ };
+ static Literal literals[] = {
+ {kInfiniteFutureStr, strlen(kInfiniteFutureStr), InfiniteFuture()},
+ {kInfinitePastStr, strlen(kInfinitePastStr), InfinitePast()},
+ };
+ strip_leading_space(&input);
+ for (const auto& lit : literals) {
+ if (y_absl::StartsWith(input, y_absl::string_view(lit.name, lit.size))) {
+ y_absl::string_view tail = input;
+ tail.remove_prefix(lit.size);
+ strip_leading_space(&tail);
+ if (tail.empty()) {
+ *time = lit.value;
+ return true;
+ }
}
}
TString error;
cctz_parts parts;
- const bool b =
- cctz::detail::parse(TString(format), TString(input),
- cctz::time_zone(tz), &parts.sec, &parts.fem, &error);
+ const bool b =
+ cctz::detail::parse(TString(format), TString(input),
+ cctz::time_zone(tz), &parts.sec, &parts.fem, &error);
if (b) {
*time = Join(parts);
} else if (err != nullptr) {
@@ -142,7 +142,7 @@ bool ParseTime(y_absl::string_view format, y_absl::string_view input,
// Functions required to support y_absl::Time flags.
bool AbslParseFlag(y_absl::string_view text, y_absl::Time* t, TString* error) {
- return y_absl::ParseTime(RFC3339_full, text, y_absl::UTCTimeZone(), t, error);
+ return y_absl::ParseTime(RFC3339_full, text, y_absl::UTCTimeZone(), t, error);
}
TString AbslUnparseFlag(y_absl::Time t) {
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/civil_time_detail.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/civil_time_detail.h
index 0e71a7cd33..ead002629b 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/civil_time_detail.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/civil_time_detail.h
@@ -106,64 +106,64 @@ CONSTEXPR_F int days_per_month(year_t y, month_t m) noexcept {
CONSTEXPR_F fields n_day(year_t y, month_t m, diff_t d, diff_t cd, hour_t hh,
minute_t mm, second_t ss) noexcept {
- year_t ey = y % 400;
- const year_t oey = ey;
- ey += (cd / 146097) * 400;
+ year_t ey = y % 400;
+ const year_t oey = ey;
+ ey += (cd / 146097) * 400;
cd %= 146097;
if (cd < 0) {
- ey -= 400;
+ ey -= 400;
cd += 146097;
}
- ey += (d / 146097) * 400;
+ ey += (d / 146097) * 400;
d = d % 146097 + cd;
if (d > 0) {
if (d > 146097) {
- ey += 400;
+ ey += 400;
d -= 146097;
}
} else {
if (d > -365) {
// We often hit the previous year when stepping a civil time backwards,
// so special case it to avoid counting up by 100/4/1-year chunks.
- ey -= 1;
- d += days_per_year(ey, m);
+ ey -= 1;
+ d += days_per_year(ey, m);
} else {
- ey -= 400;
+ ey -= 400;
d += 146097;
}
}
if (d > 365) {
- for (;;) {
- int n = days_per_century(ey, m);
- if (d <= n) break;
+ for (;;) {
+ int n = days_per_century(ey, m);
+ if (d <= n) break;
d -= n;
- ey += 100;
+ ey += 100;
}
- for (;;) {
- int n = days_per_4years(ey, m);
- if (d <= n) break;
+ for (;;) {
+ int n = days_per_4years(ey, m);
+ if (d <= n) break;
d -= n;
- ey += 4;
+ ey += 4;
}
- for (;;) {
- int n = days_per_year(ey, m);
- if (d <= n) break;
+ for (;;) {
+ int n = days_per_year(ey, m);
+ if (d <= n) break;
d -= n;
- ++ey;
+ ++ey;
}
}
if (d > 28) {
- for (;;) {
- int n = days_per_month(ey, m);
- if (d <= n) break;
+ for (;;) {
+ int n = days_per_month(ey, m);
+ if (d <= n) break;
d -= n;
if (++m > 12) {
- ++ey;
+ ++ey;
m = 1;
}
}
}
- return fields(y + (ey - oey), m, static_cast<day_t>(d), hh, mm, ss);
+ return fields(y + (ey - oey), m, static_cast<day_t>(d), hh, mm, ss);
}
CONSTEXPR_F fields n_mon(year_t y, diff_t m, diff_t d, diff_t cd, hour_t hh,
minute_t mm, second_t ss) noexcept {
@@ -416,10 +416,10 @@ class civil_time {
// Assigning arithmetic.
CONSTEXPR_M civil_time& operator+=(diff_t n) noexcept {
- return *this = *this + n;
+ return *this = *this + n;
}
CONSTEXPR_M civil_time& operator-=(diff_t n) noexcept {
- return *this = *this - n;
+ return *this = *this - n;
}
CONSTEXPR_M civil_time& operator++() noexcept { return *this += 1; }
CONSTEXPR_M civil_time operator++(int) noexcept {
@@ -436,15 +436,15 @@ class civil_time {
// Binary arithmetic operators.
friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
- return civil_time(step(T{}, a.f_, n));
+ return civil_time(step(T{}, a.f_, n));
}
friend CONSTEXPR_F civil_time operator+(diff_t n, civil_time a) noexcept {
- return a + n;
+ return a + n;
}
friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
- return n != (std::numeric_limits<diff_t>::min)()
- ? civil_time(step(T{}, a.f_, -n))
- : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
+ return n != (std::numeric_limits<diff_t>::min)()
+ ? civil_time(step(T{}, a.f_, -n))
+ : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
}
friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
return difference(T{}, lhs.f_, rhs.f_);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/time_zone.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/time_zone.h
index 524654df4b..ee0852a182 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/time_zone.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/time_zone.h
@@ -199,7 +199,7 @@ class time_zone {
// version() and description() provide additional information about the
// time zone. The content of each of the returned strings is unspecified,
// however, when the IANA Time Zone Database is the underlying data source
- // the version() string will be in the familar form (e.g, "2018e") or
+ // the version() string will be in the familar form (e.g, "2018e") or
// empty when unavailable.
//
// Note: These functions are for informational or testing purposes only.
@@ -296,7 +296,7 @@ bool join_seconds(const time_point<seconds>& sec, const femtoseconds&,
// - %E#f - Fractional seconds with # digits of precision
// - %E*f - Fractional seconds with full precision (a literal '*')
// - %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
-// - %ET - The RFC3339 "date-time" separator "T"
+// - %ET - The RFC3339 "date-time" separator "T"
//
// Note that %E0S behaves like %S, and %E0f produces no characters. In
// contrast %E*f always produces at least one digit, which may be '0'.
@@ -326,8 +326,8 @@ inline TString format(const TString& fmt, const time_point<D>& tp,
// returns the corresponding time_point. Uses strftime()-like formatting
// options, with the same extensions as cctz::format(), but with the
// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f. %Ez
-// and %E*z also accept the same inputs, which (along with %z) includes
-// 'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
+// and %E*z also accept the same inputs, which (along with %z) includes
+// 'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
//
// %Y consumes as many numeric characters as it can, so the matching data
// should always be terminated with a non-numeric. %E4Y always consumes
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/zone_info_source.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/zone_info_source.h
index fd6dc4bbb0..a8e08d0c87 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/zone_info_source.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/include/cctz/zone_info_source.h
@@ -37,7 +37,7 @@ class ZoneInfoSource {
// Until the zoneinfo data supports versioning information, we provide
// a way for a ZoneInfoSource to indicate it out-of-band. The default
- // implementation returns an empty string.
+ // implementation returns an empty string.
virtual TString Version() const;
};
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_format.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_format.cc
index 2f9597018b..73edae8488 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_format.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_format.cc
@@ -67,48 +67,48 @@ char* strptime(const char* s, const char* fmt, std::tm* tm) {
}
#endif
-// Convert a cctz::weekday to a tm_wday value (0-6, Sunday = 0).
-int ToTmWday(weekday wd) {
- switch (wd) {
- case weekday::sunday:
- return 0;
- case weekday::monday:
- return 1;
- case weekday::tuesday:
- return 2;
- case weekday::wednesday:
- return 3;
- case weekday::thursday:
- return 4;
- case weekday::friday:
- return 5;
- case weekday::saturday:
- return 6;
- }
- return 0; /*NOTREACHED*/
-}
-
-// Convert a tm_wday value (0-6, Sunday = 0) to a cctz::weekday.
-weekday FromTmWday(int tm_wday) {
- switch (tm_wday) {
- case 0:
- return weekday::sunday;
- case 1:
- return weekday::monday;
- case 2:
- return weekday::tuesday;
- case 3:
- return weekday::wednesday;
- case 4:
- return weekday::thursday;
- case 5:
- return weekday::friday;
- case 6:
- return weekday::saturday;
- }
- return weekday::sunday; /*NOTREACHED*/
-}
-
+// Convert a cctz::weekday to a tm_wday value (0-6, Sunday = 0).
+int ToTmWday(weekday wd) {
+ switch (wd) {
+ case weekday::sunday:
+ return 0;
+ case weekday::monday:
+ return 1;
+ case weekday::tuesday:
+ return 2;
+ case weekday::wednesday:
+ return 3;
+ case weekday::thursday:
+ return 4;
+ case weekday::friday:
+ return 5;
+ case weekday::saturday:
+ return 6;
+ }
+ return 0; /*NOTREACHED*/
+}
+
+// Convert a tm_wday value (0-6, Sunday = 0) to a cctz::weekday.
+weekday FromTmWday(int tm_wday) {
+ switch (tm_wday) {
+ case 0:
+ return weekday::sunday;
+ case 1:
+ return weekday::monday;
+ case 2:
+ return weekday::tuesday;
+ case 3:
+ return weekday::wednesday;
+ case 4:
+ return weekday::thursday;
+ case 5:
+ return weekday::friday;
+ case 6:
+ return weekday::saturday;
+ }
+ return weekday::sunday; /*NOTREACHED*/
+}
+
std::tm ToTM(const time_zone::absolute_lookup& al) {
std::tm tm{};
tm.tm_sec = al.cs.second();
@@ -126,19 +126,19 @@ std::tm ToTM(const time_zone::absolute_lookup& al) {
tm.tm_year = static_cast<int>(al.cs.year() - 1900);
}
- tm.tm_wday = ToTmWday(get_weekday(al.cs));
+ tm.tm_wday = ToTmWday(get_weekday(al.cs));
tm.tm_yday = get_yearday(al.cs) - 1;
tm.tm_isdst = al.is_dst ? 1 : 0;
return tm;
}
-// Returns the week of the year [0:53] given a civil day and the day on
-// which weeks are defined to start.
-int ToWeek(const civil_day& cd, weekday week_start) {
- const civil_day d(cd.year() % 400, cd.month(), cd.day());
- return static_cast<int>((d - prev_weekday(civil_year(d), week_start)) / 7);
-}
-
+// Returns the week of the year [0:53] given a civil day and the day on
+// which weeks are defined to start.
+int ToWeek(const civil_day& cd, weekday week_start) {
+ const civil_day d(cd.year() % 400, cd.month(), cd.day());
+ return static_cast<int>((d - prev_weekday(civil_year(d), week_start)) / 7);
+}
+
const char kDigits[] = "0123456789";
// Formats a 64-bit integer in the given field width. Note that it is up
@@ -216,7 +216,7 @@ void FormatTM(TString* out, const TString& fmt, const std::tm& tm) {
// strftime(3) returns the number of characters placed in the output
// array (which may be 0 characters). It also returns 0 to indicate
// an error, like the array wasn't large enough. To accommodate this,
- // the following code grows the buffer size from 2x the format string
+ // the following code grows the buffer size from 2x the format string
// length up to 32x.
for (std::size_t i = 2; i != 32; i *= 2) {
std::size_t buf_size = fmt.size() * i;
@@ -317,7 +317,7 @@ const std::int_fast64_t kExp10[kDigits10_64 + 1] = {
// - %E#S - Seconds with # digits of fractional precision
// - %E*S - Seconds with full fractional precision (a literal '*')
// - %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
-// - %ET - The RFC3339 "date-time" separator "T"
+// - %ET - The RFC3339 "date-time" separator "T"
//
// The standard specifiers from RFC3339_* (%Y, %m, %d, %H, %M, and %S) are
// handled internally for performance reasons. strftime(3) is slow due to
@@ -382,7 +382,7 @@ TString format(const TString& format, const time_point<seconds>& tp,
if (cur == end || (cur - percent) % 2 == 0) continue;
// Simple specifiers that we handle ourselves.
- if (strchr("YmdeUuWwHMSzZs%", *cur)) {
+ if (strchr("YmdeUuWwHMSzZs%", *cur)) {
if (cur - 1 != pending) {
FormatTM(&result, TString(pending, cur - 1), tm);
}
@@ -403,22 +403,22 @@ TString format(const TString& format, const time_point<seconds>& tp,
if (*cur == 'e' && *bp == '0') *bp = ' '; // for Windows
result.append(bp, static_cast<std::size_t>(ep - bp));
break;
- case 'U':
- bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::sunday));
- result.append(bp, static_cast<std::size_t>(ep - bp));
- break;
- case 'u':
- bp = Format64(ep, 0, tm.tm_wday ? tm.tm_wday : 7);
- result.append(bp, static_cast<std::size_t>(ep - bp));
- break;
- case 'W':
- bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::monday));
- result.append(bp, static_cast<std::size_t>(ep - bp));
- break;
- case 'w':
- bp = Format64(ep, 0, tm.tm_wday);
- result.append(bp, static_cast<std::size_t>(ep - bp));
- break;
+ case 'U':
+ bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::sunday));
+ result.append(bp, static_cast<std::size_t>(ep - bp));
+ break;
+ case 'u':
+ bp = Format64(ep, 0, tm.tm_wday ? tm.tm_wday : 7);
+ result.append(bp, static_cast<std::size_t>(ep - bp));
+ break;
+ case 'W':
+ bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::monday));
+ result.append(bp, static_cast<std::size_t>(ep - bp));
+ break;
+ case 'w':
+ bp = Format64(ep, 0, tm.tm_wday);
+ result.append(bp, static_cast<std::size_t>(ep - bp));
+ break;
case 'H':
bp = Format02d(ep, al.cs.hour());
result.append(bp, static_cast<std::size_t>(ep - bp));
@@ -492,14 +492,14 @@ TString format(const TString& format, const time_point<seconds>& tp,
if (*cur != 'E' || ++cur == end) continue;
// Format our extensions.
- if (*cur == 'T') {
- // Formats %ET.
- if (cur - 2 != pending) {
- FormatTM(&result, TString(pending, cur - 2), tm);
- }
- result.append("T");
- pending = ++cur;
- } else if (*cur == 'z') {
+ if (*cur == 'T') {
+ // Formats %ET.
+ if (cur - 2 != pending) {
+ FormatTM(&result, TString(pending, cur - 2), tm);
+ }
+ result.append("T");
+ pending = ++cur;
+ } else if (*cur == 'z') {
// Formats %Ez.
if (cur - 2 != pending) {
FormatTM(&result, TString(pending, cur - 2), tm);
@@ -602,7 +602,7 @@ const char* ParseOffset(const char* dp, const char* mode, int* offset) {
} else {
dp = nullptr;
}
- } else if (first == 'Z' || first == 'z') { // Zulu
+ } else if (first == 'Z' || first == 'z') { // Zulu
*offset = 0;
} else {
dp = nullptr;
@@ -653,32 +653,32 @@ const char* ParseTM(const char* dp, const char* fmt, std::tm* tm) {
return dp;
}
-// Sets year, tm_mon and tm_mday given the year, week_num, and tm_wday,
-// and the day on which weeks are defined to start. Returns false if year
-// would need to move outside its bounds.
-bool FromWeek(int week_num, weekday week_start, year_t* year, std::tm* tm) {
- const civil_year y(*year % 400);
- civil_day cd = prev_weekday(y, week_start); // week 0
- cd = next_weekday(cd - 1, FromTmWday(tm->tm_wday)) + (week_num * 7);
- if (const year_t shift = cd.year() - y.year()) {
- if (shift > 0) {
- if (*year > std::numeric_limits<year_t>::max() - shift) return false;
- } else {
- if (*year < std::numeric_limits<year_t>::min() - shift) return false;
- }
- *year += shift;
- }
- tm->tm_mon = cd.month() - 1;
- tm->tm_mday = cd.day();
- return true;
-}
-
+// Sets year, tm_mon and tm_mday given the year, week_num, and tm_wday,
+// and the day on which weeks are defined to start. Returns false if year
+// would need to move outside its bounds.
+bool FromWeek(int week_num, weekday week_start, year_t* year, std::tm* tm) {
+ const civil_year y(*year % 400);
+ civil_day cd = prev_weekday(y, week_start); // week 0
+ cd = next_weekday(cd - 1, FromTmWday(tm->tm_wday)) + (week_num * 7);
+ if (const year_t shift = cd.year() - y.year()) {
+ if (shift > 0) {
+ if (*year > std::numeric_limits<year_t>::max() - shift) return false;
+ } else {
+ if (*year < std::numeric_limits<year_t>::min() - shift) return false;
+ }
+ *year += shift;
+ }
+ tm->tm_mon = cd.month() - 1;
+ tm->tm_mday = cd.day();
+ return true;
+}
+
} // namespace
// Uses strptime(3) to parse the given input. Supports the same extended
// format specifiers as format(), although %E#S and %E*S are treated
// identically (and similarly for %E#f and %E*f). %Ez and %E*z also accept
-// the same inputs. %ET accepts either 'T' or 't'.
+// the same inputs. %ET accepts either 'T' or 't'.
//
// The standard specifiers from RFC3339_* (%Y, %m, %d, %H, %M, and %S) are
// handled internally so that we can normally avoid strptime() altogether
@@ -722,8 +722,8 @@ bool parse(const TString& format, const TString& input,
const char* fmt = format.c_str(); // NUL terminated
bool twelve_hour = false;
bool afternoon = false;
- int week_num = -1;
- weekday week_start = weekday::sunday;
+ int week_num = -1;
+ weekday week_start = weekday::sunday;
bool saw_percent_s = false;
std::int_fast64_t percent_s = 0;
@@ -762,28 +762,28 @@ bool parse(const TString& format, const TString& input,
case 'm':
data = ParseInt(data, 2, 1, 12, &tm.tm_mon);
if (data != nullptr) tm.tm_mon -= 1;
- week_num = -1;
+ week_num = -1;
continue;
case 'd':
case 'e':
data = ParseInt(data, 2, 1, 31, &tm.tm_mday);
- week_num = -1;
- continue;
- case 'U':
- data = ParseInt(data, 0, 0, 53, &week_num);
- week_start = weekday::sunday;
- continue;
- case 'W':
- data = ParseInt(data, 0, 0, 53, &week_num);
- week_start = weekday::monday;
- continue;
- case 'u':
- data = ParseInt(data, 0, 1, 7, &tm.tm_wday);
- if (data != nullptr) tm.tm_wday %= 7;
- continue;
- case 'w':
- data = ParseInt(data, 0, 0, 6, &tm.tm_wday);
+ week_num = -1;
continue;
+ case 'U':
+ data = ParseInt(data, 0, 0, 53, &week_num);
+ week_start = weekday::sunday;
+ continue;
+ case 'W':
+ data = ParseInt(data, 0, 0, 53, &week_num);
+ week_start = weekday::monday;
+ continue;
+ case 'u':
+ data = ParseInt(data, 0, 1, 7, &tm.tm_wday);
+ if (data != nullptr) tm.tm_wday %= 7;
+ continue;
+ case 'w':
+ data = ParseInt(data, 0, 0, 6, &tm.tm_wday);
+ continue;
case 'H':
data = ParseInt(data, 2, 0, 23, &tm.tm_hour);
twelve_hour = false;
@@ -832,15 +832,15 @@ bool parse(const TString& format, const TString& input,
data = (*data == '%' ? data + 1 : nullptr);
continue;
case 'E':
- if (fmt[0] == 'T') {
- if (*data == 'T' || *data == 't') {
- ++data;
- ++fmt;
- } else {
- data = nullptr;
- }
- continue;
- }
+ if (fmt[0] == 'T') {
+ if (*data == 'T' || *data == 't') {
+ ++data;
+ ++fmt;
+ } else {
+ data = nullptr;
+ }
+ continue;
+ }
if (fmt[0] == 'z' || (fmt[0] == '*' && fmt[1] == 'z')) {
data = ParseOffset(data, ":", &offset);
if (data != nullptr) saw_offset = true;
@@ -938,7 +938,7 @@ bool parse(const TString& format, const TString& input,
// Skip any remaining whitespace.
while (std::isspace(*data)) ++data;
- // parse() must consume the entire input string.
+ // parse() must consume the entire input string.
if (*data != '\0') {
if (err != nullptr) *err = "Illegal trailing data in input string";
return false;
@@ -973,14 +973,14 @@ bool parse(const TString& format, const TString& input,
year += 1900;
}
- // Compute year, tm.tm_mon and tm.tm_mday if we parsed a week number.
- if (week_num != -1) {
- if (!FromWeek(week_num, week_start, &year, &tm)) {
- if (err != nullptr) *err = "Out-of-range field";
- return false;
- }
- }
-
+ // Compute year, tm.tm_mon and tm.tm_mday if we parsed a week number.
+ if (week_num != -1) {
+ if (!FromWeek(week_num, week_start, &year, &tm)) {
+ if (err != nullptr) *err = "Out-of-range field";
+ return false;
+ }
+ }
+
const int month = tm.tm_mon + 1;
civil_second cs(year, month, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.cc
index 3810defe3c..df48bd6976 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.cc
@@ -15,7 +15,7 @@
#include "time_zone_impl.h"
#include <deque>
-#include <memory>
+#include <memory>
#include <mutex>
#include <util/generic/string.h>
#include <unordered_map>
@@ -49,16 +49,16 @@ std::mutex& TimeZoneMutex() {
time_zone time_zone::Impl::UTC() { return time_zone(UTCImpl()); }
bool time_zone::Impl::LoadTimeZone(const TString& name, time_zone* tz) {
- const Impl* const utc_impl = UTCImpl();
+ const Impl* const utc_impl = UTCImpl();
- // Check for UTC (which is never a key in time_zone_map).
+ // Check for UTC (which is never a key in time_zone_map).
auto offset = seconds::zero();
if (FixedOffsetFromName(name, &offset) && offset == seconds::zero()) {
*tz = time_zone(utc_impl);
return true;
}
- // Check whether the time zone has already been loaded.
+ // Check whether the time zone has already been loaded.
{
std::lock_guard<std::mutex> lock(TimeZoneMutex());
if (time_zone_map != nullptr) {
@@ -70,15 +70,15 @@ bool time_zone::Impl::LoadTimeZone(const TString& name, time_zone* tz) {
}
}
- // Load the new time zone (outside the lock).
- std::unique_ptr<const Impl> new_impl(new Impl(name));
-
- // Add the new time zone to the map.
+ // Load the new time zone (outside the lock).
+ std::unique_ptr<const Impl> new_impl(new Impl(name));
+
+ // Add the new time zone to the map.
std::lock_guard<std::mutex> lock(TimeZoneMutex());
if (time_zone_map == nullptr) time_zone_map = new TimeZoneImplByName;
const Impl*& impl = (*time_zone_map)[name];
- if (impl == nullptr) { // this thread won any load race
- impl = new_impl->zone_ ? new_impl.release() : utc_impl;
+ if (impl == nullptr) { // this thread won any load race
+ impl = new_impl->zone_ ? new_impl.release() : utc_impl;
}
*tz = time_zone(impl);
return impl != utc_impl;
@@ -99,11 +99,11 @@ void time_zone::Impl::ClearTimeZoneMapTestOnly() {
}
}
-time_zone::Impl::Impl(const TString& name)
- : name_(name), zone_(TimeZoneIf::Load(name_)) {}
+time_zone::Impl::Impl(const TString& name)
+ : name_(name), zone_(TimeZoneIf::Load(name_)) {}
const time_zone::Impl* time_zone::Impl::UTCImpl() {
- static const Impl* utc_impl = new Impl("UTC"); // never fails
+ static const Impl* utc_impl = new Impl("UTC"); // never fails
return utc_impl;
}
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.h
index c014ab41df..456025bf91 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_impl.h
@@ -71,7 +71,7 @@ class time_zone::Impl {
return zone_->PrevTransition(tp, trans);
}
- // Returns an implementation-defined version string for this time zone.
+ // Returns an implementation-defined version string for this time zone.
TString Version() const { return zone_->Version(); }
// Returns an implementation-defined description of this time zone.
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.cc
index 72f7bdc3ca..5633f367f4 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.cc
@@ -84,27 +84,27 @@ const std::int_least32_t kSecsPerYear[2] = {
366 * kSecsPerDay,
};
-// Convert a cctz::weekday to a POSIX TZ weekday number (0==Sun, ..., 6=Sat).
-inline int ToPosixWeekday(weekday wd) {
- switch (wd) {
- case weekday::sunday:
- return 0;
- case weekday::monday:
- return 1;
- case weekday::tuesday:
- return 2;
- case weekday::wednesday:
- return 3;
- case weekday::thursday:
- return 4;
- case weekday::friday:
- return 5;
- case weekday::saturday:
- return 6;
- }
- return 0; /*NOTREACHED*/
-}
-
+// Convert a cctz::weekday to a POSIX TZ weekday number (0==Sun, ..., 6=Sat).
+inline int ToPosixWeekday(weekday wd) {
+ switch (wd) {
+ case weekday::sunday:
+ return 0;
+ case weekday::monday:
+ return 1;
+ case weekday::tuesday:
+ return 2;
+ case weekday::wednesday:
+ return 3;
+ case weekday::thursday:
+ return 4;
+ case weekday::friday:
+ return 5;
+ case weekday::saturday:
+ return 6;
+ }
+ return 0; /*NOTREACHED*/
+}
+
// Single-byte, unsigned numeric values are encoded directly.
inline std::uint_fast8_t Decode8(const char* cp) {
return static_cast<std::uint_fast8_t>(*cp) & 0xff;
@@ -210,13 +210,13 @@ bool TimeZoneInfo::ResetToBuiltinUTC(const seconds& offset) {
tt.is_dst = false;
tt.abbr_index = 0;
- // We temporarily add some redundant, contemporary (2015 through 2025)
+ // We temporarily add some redundant, contemporary (2015 through 2025)
// transitions for performance reasons. See TimeZoneInfo::LocalTime().
// TODO: Fix the performance issue and remove the extra transitions.
transitions_.clear();
transitions_.reserve(12);
for (const std::int_fast64_t unix_time : {
- -(1LL << 59), // a "first half" transition
+ -(1LL << 59), // a "first half" transition
1420070400LL, // 2015-01-01T00:00:00+00:00
1451606400LL, // 2016-01-01T00:00:00+00:00
1483228800LL, // 2017-01-01T00:00:00+00:00
@@ -226,8 +226,8 @@ bool TimeZoneInfo::ResetToBuiltinUTC(const seconds& offset) {
1609459200LL, // 2021-01-01T00:00:00+00:00
1640995200LL, // 2022-01-01T00:00:00+00:00
1672531200LL, // 2023-01-01T00:00:00+00:00
- 1704067200LL, // 2024-01-01T00:00:00+00:00
- 1735689600LL, // 2025-01-01T00:00:00+00:00
+ 1704067200LL, // 2024-01-01T00:00:00+00:00
+ 1735689600LL, // 2025-01-01T00:00:00+00:00
}) {
Transition& tr(*transitions_.emplace(transitions_.end()));
tr.unix_time = unix_time;
@@ -238,8 +238,8 @@ bool TimeZoneInfo::ResetToBuiltinUTC(const seconds& offset) {
default_transition_type_ = 0;
abbreviations_ = FixedOffsetToAbbr(offset);
- abbreviations_.append(1, '\0');
- future_spec_.clear(); // never needed for a fixed-offset zone
+ abbreviations_.append(1, '\0');
+ future_spec_.clear(); // never needed for a fixed-offset zone
extended_ = false;
tt.civil_max = LocalTime(seconds::max().count(), tt).cs;
@@ -288,108 +288,108 @@ bool TimeZoneInfo::EquivTransitions(std::uint_fast8_t tt1_index,
if (tt1_index == tt2_index) return true;
const TransitionType& tt1(transition_types_[tt1_index]);
const TransitionType& tt2(transition_types_[tt2_index]);
- if (tt1.utc_offset != tt2.utc_offset) return false;
+ if (tt1.utc_offset != tt2.utc_offset) return false;
if (tt1.is_dst != tt2.is_dst) return false;
if (tt1.abbr_index != tt2.abbr_index) return false;
return true;
}
-// Find/make a transition type with these attributes.
-bool TimeZoneInfo::GetTransitionType(std::int_fast32_t utc_offset, bool is_dst,
- const TString& abbr,
- std::uint_least8_t* index) {
- std::size_t type_index = 0;
- std::size_t abbr_index = abbreviations_.size();
- for (; type_index != transition_types_.size(); ++type_index) {
- const TransitionType& tt(transition_types_[type_index]);
- const char* tt_abbr = &*abbreviations_.begin() + tt.abbr_index;
- if (tt_abbr == abbr) abbr_index = tt.abbr_index;
- if (tt.utc_offset == utc_offset && tt.is_dst == is_dst) {
- if (abbr_index == tt.abbr_index) break; // reuse
- }
- }
- if (type_index > 255 || abbr_index > 255) {
- // No index space (8 bits) available for a new type or abbreviation.
- return false;
- }
- if (type_index == transition_types_.size()) {
- TransitionType& tt(*transition_types_.emplace(transition_types_.end()));
- tt.utc_offset = static_cast<std::int_least32_t>(utc_offset);
- tt.is_dst = is_dst;
- if (abbr_index == abbreviations_.size()) {
- abbreviations_.append(abbr);
- abbreviations_.append(1, '\0');
- }
- tt.abbr_index = static_cast<std::uint_least8_t>(abbr_index);
- }
- *index = static_cast<std::uint_least8_t>(type_index);
- return true;
-}
-
+// Find/make a transition type with these attributes.
+bool TimeZoneInfo::GetTransitionType(std::int_fast32_t utc_offset, bool is_dst,
+ const TString& abbr,
+ std::uint_least8_t* index) {
+ std::size_t type_index = 0;
+ std::size_t abbr_index = abbreviations_.size();
+ for (; type_index != transition_types_.size(); ++type_index) {
+ const TransitionType& tt(transition_types_[type_index]);
+ const char* tt_abbr = &*abbreviations_.begin() + tt.abbr_index;
+ if (tt_abbr == abbr) abbr_index = tt.abbr_index;
+ if (tt.utc_offset == utc_offset && tt.is_dst == is_dst) {
+ if (abbr_index == tt.abbr_index) break; // reuse
+ }
+ }
+ if (type_index > 255 || abbr_index > 255) {
+ // No index space (8 bits) available for a new type or abbreviation.
+ return false;
+ }
+ if (type_index == transition_types_.size()) {
+ TransitionType& tt(*transition_types_.emplace(transition_types_.end()));
+ tt.utc_offset = static_cast<std::int_least32_t>(utc_offset);
+ tt.is_dst = is_dst;
+ if (abbr_index == abbreviations_.size()) {
+ abbreviations_.append(abbr);
+ abbreviations_.append(1, '\0');
+ }
+ tt.abbr_index = static_cast<std::uint_least8_t>(abbr_index);
+ }
+ *index = static_cast<std::uint_least8_t>(type_index);
+ return true;
+}
+
// Use the POSIX-TZ-environment-variable-style string to handle times
// in years after the last transition stored in the zoneinfo data.
-bool TimeZoneInfo::ExtendTransitions() {
+bool TimeZoneInfo::ExtendTransitions() {
extended_ = false;
- if (future_spec_.empty()) return true; // last transition prevails
+ if (future_spec_.empty()) return true; // last transition prevails
PosixTimeZone posix;
- if (!ParsePosixSpec(future_spec_, &posix)) return false;
+ if (!ParsePosixSpec(future_spec_, &posix)) return false;
- // Find transition type for the future std specification.
- std::uint_least8_t std_ti;
- if (!GetTransitionType(posix.std_offset, false, posix.std_abbr, &std_ti))
- return false;
+ // Find transition type for the future std specification.
+ std::uint_least8_t std_ti;
+ if (!GetTransitionType(posix.std_offset, false, posix.std_abbr, &std_ti))
+ return false;
- if (posix.dst_abbr.empty()) { // std only
- // The future specification should match the last transition, and
- // that means that handling the future will fall out naturally.
- return EquivTransitions(transitions_.back().type_index, std_ti);
+ if (posix.dst_abbr.empty()) { // std only
+ // The future specification should match the last transition, and
+ // that means that handling the future will fall out naturally.
+ return EquivTransitions(transitions_.back().type_index, std_ti);
}
- // Find transition type for the future dst specification.
- std::uint_least8_t dst_ti;
- if (!GetTransitionType(posix.dst_offset, true, posix.dst_abbr, &dst_ti))
- return false;
+ // Find transition type for the future dst specification.
+ std::uint_least8_t dst_ti;
+ if (!GetTransitionType(posix.dst_offset, true, posix.dst_abbr, &dst_ti))
+ return false;
// Extend the transitions for an additional 400 years using the
// future specification. Years beyond those can be handled by
// mapping back to a cycle-equivalent year within that range.
- // We may need two additional transitions for the current year.
- transitions_.reserve(transitions_.size() + 400 * 2 + 2);
+ // We may need two additional transitions for the current year.
+ transitions_.reserve(transitions_.size() + 400 * 2 + 2);
extended_ = true;
- const Transition& last(transitions_.back());
- const std::int_fast64_t last_time = last.unix_time;
- const TransitionType& last_tt(transition_types_[last.type_index]);
- last_year_ = LocalTime(last_time, last_tt).cs.year();
- bool leap_year = IsLeap(last_year_);
- const civil_second jan1(last_year_);
- std::int_fast64_t jan1_time = jan1 - civil_second();
- int jan1_weekday = ToPosixWeekday(get_weekday(jan1));
-
- Transition dst = {0, dst_ti, civil_second(), civil_second()};
- Transition std = {0, std_ti, civil_second(), civil_second()};
- for (const year_t limit = last_year_ + 400;; ++last_year_) {
- auto dst_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_start);
- auto std_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_end);
- dst.unix_time = jan1_time + dst_trans_off - posix.std_offset;
- std.unix_time = jan1_time + std_trans_off - posix.dst_offset;
- const auto* ta = dst.unix_time < std.unix_time ? &dst : &std;
- const auto* tb = dst.unix_time < std.unix_time ? &std : &dst;
- if (last_time < tb->unix_time) {
- if (last_time < ta->unix_time) transitions_.push_back(*ta);
- transitions_.push_back(*tb);
- }
- if (last_year_ == limit) break;
+ const Transition& last(transitions_.back());
+ const std::int_fast64_t last_time = last.unix_time;
+ const TransitionType& last_tt(transition_types_[last.type_index]);
+ last_year_ = LocalTime(last_time, last_tt).cs.year();
+ bool leap_year = IsLeap(last_year_);
+ const civil_second jan1(last_year_);
+ std::int_fast64_t jan1_time = jan1 - civil_second();
+ int jan1_weekday = ToPosixWeekday(get_weekday(jan1));
+
+ Transition dst = {0, dst_ti, civil_second(), civil_second()};
+ Transition std = {0, std_ti, civil_second(), civil_second()};
+ for (const year_t limit = last_year_ + 400;; ++last_year_) {
+ auto dst_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_start);
+ auto std_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_end);
+ dst.unix_time = jan1_time + dst_trans_off - posix.std_offset;
+ std.unix_time = jan1_time + std_trans_off - posix.dst_offset;
+ const auto* ta = dst.unix_time < std.unix_time ? &dst : &std;
+ const auto* tb = dst.unix_time < std.unix_time ? &std : &dst;
+ if (last_time < tb->unix_time) {
+ if (last_time < ta->unix_time) transitions_.push_back(*ta);
+ transitions_.push_back(*tb);
+ }
+ if (last_year_ == limit) break;
jan1_time += kSecsPerYear[leap_year];
jan1_weekday = (jan1_weekday + kDaysPerYear[leap_year]) % 7;
- leap_year = !leap_year && IsLeap(last_year_ + 1);
+ leap_year = !leap_year && IsLeap(last_year_ + 1);
}
-
- return true;
+
+ return true;
}
-bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
+bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
// Read and validate the header.
tzhead tzh;
if (zip->Read(&tzh, sizeof(tzh)) != sizeof(tzh)) return false;
@@ -427,7 +427,7 @@ bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
const char* bp = tbuf.data();
// Decode and validate the transitions.
- transitions_.reserve(hdr.timecnt + 2);
+ transitions_.reserve(hdr.timecnt + 2);
transitions_.resize(hdr.timecnt);
for (std::size_t i = 0; i != hdr.timecnt; ++i) {
transitions_[i].unix_time = (time_len == 4) ? Decode32(bp) : Decode64(bp);
@@ -446,7 +446,7 @@ bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
}
// Decode and validate the transition types.
- transition_types_.reserve(hdr.typecnt + 2);
+ transition_types_.reserve(hdr.typecnt + 2);
transition_types_.resize(hdr.typecnt);
for (std::size_t i = 0; i != hdr.typecnt; ++i) {
transition_types_[i].utc_offset =
@@ -473,7 +473,7 @@ bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
}
// Copy all the abbreviations.
- abbreviations_.reserve(hdr.charcnt + 10);
+ abbreviations_.reserve(hdr.charcnt + 10);
abbreviations_.assign(bp, hdr.charcnt);
bp += hdr.charcnt;
@@ -505,7 +505,7 @@ bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
// If we did not find version information during the standard loading
// process (as of tzh_version '3' that is unsupported), then ask the
- // ZoneInfoSource for any out-of-bound version string it may be privy to.
+ // ZoneInfoSource for any out-of-bound version string it may be privy to.
if (version_.empty()) {
version_ = zip->Version();
}
@@ -524,30 +524,30 @@ bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
transitions_.resize(hdr.timecnt);
// Ensure that there is always a transition in the first half of the
- // time line (the second half is handled below) so that the signed
- // difference between a civil_second and the civil_second of its
- // previous transition is always representable, without overflow.
+ // time line (the second half is handled below) so that the signed
+ // difference between a civil_second and the civil_second of its
+ // previous transition is always representable, without overflow.
if (transitions_.empty() || transitions_.front().unix_time >= 0) {
Transition& tr(*transitions_.emplace(transitions_.begin()));
- tr.unix_time = -(1LL << 59); // -18267312070-10-26T17:01:52+00:00
+ tr.unix_time = -(1LL << 59); // -18267312070-10-26T17:01:52+00:00
tr.type_index = default_transition_type_;
}
// Extend the transitions using the future specification.
- if (!ExtendTransitions()) return false;
-
- // Ensure that there is always a transition in the second half of the
- // time line (the first half is handled above) so that the signed
- // difference between a civil_second and the civil_second of its
- // previous transition is always representable, without overflow.
- const Transition& last(transitions_.back());
- if (last.unix_time < 0) {
- const std::uint_fast8_t type_index = last.type_index;
- Transition& tr(*transitions_.emplace(transitions_.end()));
- tr.unix_time = 2147483647; // 2038-01-19T03:14:07+00:00
- tr.type_index = type_index;
- }
-
+ if (!ExtendTransitions()) return false;
+
+ // Ensure that there is always a transition in the second half of the
+ // time line (the first half is handled above) so that the signed
+ // difference between a civil_second and the civil_second of its
+ // previous transition is always representable, without overflow.
+ const Transition& last(transitions_.back());
+ if (last.unix_time < 0) {
+ const std::uint_fast8_t type_index = last.type_index;
+ Transition& tr(*transitions_.emplace(transitions_.end()));
+ tr.unix_time = 2147483647; // 2038-01-19T03:14:07+00:00
+ tr.type_index = type_index;
+ }
+
// Compute the local civil time for each transition and the preceding
// second. These will be used for reverse conversions in MakeTime().
const TransitionType* ttp = &transition_types_[default_transition_type_];
@@ -786,13 +786,13 @@ bool TimeZoneInfo::Load(const TString& name) {
// Find and use a ZoneInfoSource to load the named zone.
auto zip = cctz_extension::zone_info_source_factory(
- name, [](const TString& n) -> std::unique_ptr<ZoneInfoSource> {
- if (auto z = FileZoneInfoSource::Open(n)) return z;
- if (auto z = AndroidZoneInfoSource::Open(n)) return z;
+ name, [](const TString& n) -> std::unique_ptr<ZoneInfoSource> {
+ if (auto z = FileZoneInfoSource::Open(n)) return z;
+ if (auto z = AndroidZoneInfoSource::Open(n)) return z;
if (auto z = FuchsiaZoneInfoSource::Open(n)) return z;
return nullptr;
});
- return zip != nullptr && Load(zip.get());
+ return zip != nullptr && Load(zip.get());
}
// BreakTime() translation for a particular transition type.
@@ -966,8 +966,8 @@ bool TimeZoneInfo::NextTransition(const time_point<seconds>& tp,
const Transition* begin = &transitions_[0];
const Transition* end = begin + transitions_.size();
if (begin->unix_time <= -(1LL << 59)) {
- // Do not report the BIG_BANG found in some zoneinfo data as it is
- // really a sentinel, not a transition. See pre-2018f tz/zic.c.
+ // Do not report the BIG_BANG found in some zoneinfo data as it is
+ // really a sentinel, not a transition. See pre-2018f tz/zic.c.
++begin;
}
std::int_fast64_t unix_time = ToUnixSeconds(tp);
@@ -992,8 +992,8 @@ bool TimeZoneInfo::PrevTransition(const time_point<seconds>& tp,
const Transition* begin = &transitions_[0];
const Transition* end = begin + transitions_.size();
if (begin->unix_time <= -(1LL << 59)) {
- // Do not report the BIG_BANG found in some zoneinfo data as it is
- // really a sentinel, not a transition. See pre-2018f tz/zic.c.
+ // Do not report the BIG_BANG found in some zoneinfo data as it is
+ // really a sentinel, not a transition. See pre-2018f tz/zic.c.
++begin;
}
std::int_fast64_t unix_time = ToUnixSeconds(tp);
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.h
index e55fd51847..f35d6cc60b 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_info.h
@@ -95,14 +95,14 @@ class TimeZoneInfo : public TimeZoneIf {
std::size_t DataLength(std::size_t time_len) const;
};
- bool GetTransitionType(std::int_fast32_t utc_offset, bool is_dst,
- const TString& abbr, std::uint_least8_t* index);
+ bool GetTransitionType(std::int_fast32_t utc_offset, bool is_dst,
+ const TString& abbr, std::uint_least8_t* index);
bool EquivTransitions(std::uint_fast8_t tt1_index,
std::uint_fast8_t tt2_index) const;
- bool ExtendTransitions();
+ bool ExtendTransitions();
bool ResetToBuiltinUTC(const seconds& offset);
- bool Load(ZoneInfoSource* zip);
+ bool Load(ZoneInfoSource* zip);
// Helpers for BreakTime() and MakeTime().
time_zone::absolute_lookup LocalTime(std::int_fast64_t unix_time,
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_libc.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_libc.cc
index a73832fc29..a7ad1a0f0a 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_libc.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/time_zone_libc.cc
@@ -27,12 +27,12 @@
#include "y_absl/time/internal/cctz/include/cctz/civil_time.h"
#include "y_absl/time/internal/cctz/include/cctz/time_zone.h"
-#if defined(_AIX)
-extern "C" {
-extern long altzone;
-}
-#endif
-
+#if defined(_AIX)
+extern "C" {
+extern long altzone;
+}
+#endif
+
namespace y_absl {
ABSL_NAMESPACE_BEGIN
namespace time_internal {
@@ -50,7 +50,7 @@ auto tm_zone(const std::tm& tm) -> decltype(_tzname[0]) {
const bool is_dst = tm.tm_isdst > 0;
return _tzname[is_dst];
}
-#elif defined(__sun) || defined(_AIX)
+#elif defined(__sun) || defined(_AIX)
// Uses the globals: 'timezone', 'altzone' and 'tzname'.
auto tm_gmtoff(const std::tm& tm) -> decltype(timezone) {
const bool is_dst = tm.tm_isdst > 0;
@@ -159,8 +159,8 @@ std::time_t find_trans(std::time_t lo, std::time_t hi, int offset) {
std::tm tm;
while (lo + 1 != hi) {
const std::time_t mid = lo + (hi - lo) / 2;
- std::tm* tmp = local_time(&mid, &tm);
- if (tmp != nullptr) {
+ std::tm* tmp = local_time(&mid, &tm);
+ if (tmp != nullptr) {
if (tm_gmtoff(*tmp) == offset) {
hi = mid;
} else {
@@ -170,8 +170,8 @@ std::time_t find_trans(std::time_t lo, std::time_t hi, int offset) {
// If std::tm cannot hold some result we resort to a linear search,
// ignoring all failed conversions. Slow, but never really happens.
while (++lo != hi) {
- tmp = local_time(&lo, &tm);
- if (tmp != nullptr) {
+ tmp = local_time(&lo, &tm);
+ if (tmp != nullptr) {
if (tm_gmtoff(*tmp) == offset) break;
}
}
@@ -231,10 +231,10 @@ time_zone::civil_lookup TimeZoneLibC::MakeTime(const civil_second& cs) const {
civil_second() + ToUnixSeconds(time_point<seconds>::min());
static const civil_second max_tp_cs =
civil_second() + ToUnixSeconds(time_point<seconds>::max());
- const time_point<seconds> tp = (cs < min_tp_cs) ? time_point<seconds>::min()
- : (cs > max_tp_cs)
- ? time_point<seconds>::max()
- : FromUnixSeconds(cs - civil_second());
+ const time_point<seconds> tp = (cs < min_tp_cs) ? time_point<seconds>::min()
+ : (cs > max_tp_cs)
+ ? time_point<seconds>::max()
+ : FromUnixSeconds(cs - civil_second());
return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
}
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/tzfile.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/tzfile.h
index 31e8598257..6622ea0423 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/tzfile.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/internal/cctz/src/tzfile.h
@@ -83,13 +83,13 @@ struct tzhead {
** If tzh_version is '2' or greater, the above is followed by a second instance
** of tzhead and a second instance of the data in which each coded transition
** time uses 8 rather than 4 chars,
-** then a POSIX-TZ-environment-variable-style string for use in handling
+** then a POSIX-TZ-environment-variable-style string for use in handling
** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX representation for
** such instants).
**
** If tz_version is '3' or greater, the above is extended as follows.
-** First, the POSIX TZ string's hour offset may range from -167
+** First, the POSIX TZ string's hour offset may range from -167
** through 167 as compared to the POSIX-required 0 through 24.
** Second, its DST start time may be January 1 at 00:00 and its stop
** time December 31 at 24:00 plus the difference between DST and
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.cc
index 441638b256..0518296cc9 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.cc
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.cc
@@ -60,10 +60,10 @@ inline cctz::time_point<cctz::seconds> unix_epoch() {
inline int64_t FloorToUnit(y_absl::Duration d, y_absl::Duration unit) {
y_absl::Duration rem;
int64_t q = y_absl::IDivDuration(d, unit, &rem);
- return (q > 0 || rem >= ZeroDuration() ||
- q == std::numeric_limits<int64_t>::min())
- ? q
- : q - 1;
+ return (q > 0 || rem >= ZeroDuration() ||
+ q == std::numeric_limits<int64_t>::min())
+ ? q
+ : q - 1;
}
inline y_absl::Time::Breakdown InfiniteFutureBreakdown() {
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.h b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.h
index 16150ad3b6..dd2a947c19 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.h
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time.h
@@ -488,12 +488,12 @@ Duration Hours(T n) {
//
// y_absl::Duration d = y_absl::Milliseconds(1500);
// int64_t isec = y_absl::ToInt64Seconds(d); // isec == 1
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Nanoseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Microseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Milliseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Seconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Minutes(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Hours(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Nanoseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Microseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Milliseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Seconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Minutes(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Hours(Duration d);
// ToDoubleNanoSeconds()
// ToDoubleMicroseconds()
@@ -510,12 +510,12 @@ ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Hours(Duration d);
//
// y_absl::Duration d = y_absl::Milliseconds(1500);
// double dsec = y_absl::ToDoubleSeconds(d); // dsec == 1.5
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleNanoseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMicroseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMilliseconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleSeconds(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMinutes(Duration d);
-ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleHours(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleNanoseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMicroseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMilliseconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleSeconds(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleMinutes(Duration d);
+ABSL_ATTRIBUTE_PURE_FUNCTION double ToDoubleHours(Duration d);
// FromChrono()
//
@@ -575,7 +575,7 @@ inline std::ostream& operator<<(std::ostream& os, Duration d) {
// suffix. The valid suffixes are "ns", "us" "ms", "s", "m", and "h".
// Simple examples include "300ms", "-1.5h", and "2h45m". Parses "0" as
// `ZeroDuration()`. Parses "inf" and "-inf" as +/- `InfiniteDuration()`.
-bool ParseDuration(y_absl::string_view dur_string, Duration* d);
+bool ParseDuration(y_absl::string_view dur_string, Duration* d);
// AbslParseFlag()
//
@@ -679,7 +679,7 @@ class Time {
// Deprecated. Use `y_absl::TimeZone::CivilInfo`.
struct
Breakdown {
- int64_t year; // year (e.g., 2013)
+ int64_t year; // year (e.g., 2013)
int month; // month of year [1:12]
int day; // day of month [1:31]
int hour; // hour of day [0:23]
@@ -1071,13 +1071,13 @@ class TimeZone {
// Loads the named zone. May perform I/O on the initial load of the named
// zone. If the name is invalid, or some other kind of error occurs, returns
// `false` and `*tz` is set to the UTC time zone.
-inline bool LoadTimeZone(y_absl::string_view name, TimeZone* tz) {
+inline bool LoadTimeZone(y_absl::string_view name, TimeZone* tz) {
if (name == "localtime") {
*tz = TimeZone(time_internal::cctz::local_time_zone());
return true;
}
time_internal::cctz::time_zone cz;
- const bool b = time_internal::cctz::load_time_zone(TString(name), &cz);
+ const bool b = time_internal::cctz::load_time_zone(TString(name), &cz);
*tz = TimeZone(cz);
return b;
}
@@ -1230,15 +1230,15 @@ inline Time FromDateTime(int64_t year, int mon, int day, int hour,
//
// Converts the `tm_year`, `tm_mon`, `tm_mday`, `tm_hour`, `tm_min`, and
// `tm_sec` fields to an `y_absl::Time` using the given time zone. See ctime(3)
-// for a description of the expected values of the tm fields. If the civil time
-// is unique (see `y_absl::TimeZone::At(y_absl::CivilSecond)` above), the matching
-// time instant is returned. Otherwise, the `tm_isdst` field is consulted to
-// choose between the possible results. For a repeated civil time, `tm_isdst !=
-// 0` returns the matching DST instant, while `tm_isdst == 0` returns the
-// matching non-DST instant. For a skipped civil time there is no matching
-// instant, so `tm_isdst != 0` returns the DST instant, and `tm_isdst == 0`
-// returns the non-DST instant, that would have matched if the transition never
-// happened.
+// for a description of the expected values of the tm fields. If the civil time
+// is unique (see `y_absl::TimeZone::At(y_absl::CivilSecond)` above), the matching
+// time instant is returned. Otherwise, the `tm_isdst` field is consulted to
+// choose between the possible results. For a repeated civil time, `tm_isdst !=
+// 0` returns the matching DST instant, while `tm_isdst == 0` returns the
+// matching non-DST instant. For a skipped civil time there is no matching
+// instant, so `tm_isdst != 0` returns the DST instant, and `tm_isdst == 0`
+// returns the non-DST instant, that would have matched if the transition never
+// happened.
Time FromTM(const struct tm& tm, TimeZone tz);
// ToTM()
@@ -1257,15 +1257,15 @@ struct tm ToTM(Time t, TimeZone tz);
// time with UTC offset. Also note the use of "%Y": RFC3339 mandates that
// years have exactly four digits, but we allow them to take their natural
// width.
-ABSL_DLL extern const char RFC3339_full[]; // %Y-%m-%d%ET%H:%M:%E*S%Ez
-ABSL_DLL extern const char RFC3339_sec[]; // %Y-%m-%d%ET%H:%M:%S%Ez
+ABSL_DLL extern const char RFC3339_full[]; // %Y-%m-%d%ET%H:%M:%E*S%Ez
+ABSL_DLL extern const char RFC3339_sec[]; // %Y-%m-%d%ET%H:%M:%S%Ez
// RFC1123_full
// RFC1123_no_wday
//
// FormatTime()/ParseTime() format specifiers for RFC1123 date/time strings.
-ABSL_DLL extern const char RFC1123_full[]; // %a, %d %b %E4Y %H:%M:%S %z
-ABSL_DLL extern const char RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
+ABSL_DLL extern const char RFC1123_full[]; // %a, %d %b %E4Y %H:%M:%S %z
+ABSL_DLL extern const char RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
// FormatTime()
//
@@ -1280,7 +1280,7 @@ ABSL_DLL extern const char RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
// - %E#f - Fractional seconds with # digits of precision
// - %E*f - Fractional seconds with full precision (a literal '*')
// - %E4Y - Four-character years (-999 ... -001, 0000, 0001 ... 9999)
-// - %ET - The RFC3339 "date-time" separator "T"
+// - %ET - The RFC3339 "date-time" separator "T"
//
// Note that %E0S behaves like %S, and %E0f produces no characters. In
// contrast %E*f always produces at least one digit, which may be '0'.
@@ -1304,7 +1304,7 @@ ABSL_DLL extern const char RFC1123_no_wday[]; // %d %b %E4Y %H:%M:%S %z
// `y_absl::InfinitePast()`, the returned string will be exactly "infinite-past".
// In both cases the given format string and `y_absl::TimeZone` are ignored.
//
-TString FormatTime(y_absl::string_view format, Time t, TimeZone tz);
+TString FormatTime(y_absl::string_view format, Time t, TimeZone tz);
// Convenience functions that format the given time using the RFC3339_full
// format. The first overload uses the provided TimeZone, while the second
@@ -1323,8 +1323,8 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
// returns the corresponding `y_absl::Time`. Uses strftime()-like formatting
// options, with the same extensions as FormatTime(), but with the
// exceptions that %E#S is interpreted as %E*S, and %E#f as %E*f. %Ez
-// and %E*z also accept the same inputs, which (along with %z) includes
-// 'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
+// and %E*z also accept the same inputs, which (along with %z) includes
+// 'z' and 'Z' as synonyms for +00:00. %ET accepts either 'T' or 't'.
//
// %Y consumes as many numeric characters as it can, so the matching data
// should always be terminated with a non-numeric. %E4Y always consumes
@@ -1366,7 +1366,7 @@ inline std::ostream& operator<<(std::ostream& os, Time t) {
// If the input string is "infinite-past", the returned `y_absl::Time` will be
// `y_absl::InfinitePast()` and `true` will be returned.
//
-bool ParseTime(y_absl::string_view format, y_absl::string_view input, Time* time,
+bool ParseTime(y_absl::string_view format, y_absl::string_view input, Time* time,
TString* err);
// Like ParseTime() above, but if the format string does not contain a UTC
@@ -1376,7 +1376,7 @@ bool ParseTime(y_absl::string_view format, y_absl::string_view input, Time* time
// of ambiguity or non-existence, in which case the "pre" time (as defined
// by TimeZone::TimeInfo) is returned. For these reasons we recommend that
// all date/time strings include a UTC offset so they're context independent.
-bool ParseTime(y_absl::string_view format, y_absl::string_view input, TimeZone tz,
+bool ParseTime(y_absl::string_view format, y_absl::string_view input, TimeZone tz,
Time* time, TString* err);
// ============================================================================
@@ -1401,7 +1401,7 @@ constexpr Duration MakeDuration(int64_t hi, int64_t lo) {
// it's positive and can be converted to int64_t without risk of UB.
inline Duration MakePosDoubleDuration(double n) {
const int64_t int_secs = static_cast<int64_t>(n);
- const uint32_t ticks = static_cast<uint32_t>(
+ const uint32_t ticks = static_cast<uint32_t>(
std::round((n - static_cast<double>(int_secs)) * kTicksPerSecond));
return ticks < kTicksPerSecond
? MakeDuration(int_secs, ticks)
@@ -1529,10 +1529,10 @@ T ToChronoDuration(Duration d) {
constexpr bool operator<(Duration lhs, Duration rhs) {
return time_internal::GetRepHi(lhs) != time_internal::GetRepHi(rhs)
? time_internal::GetRepHi(lhs) < time_internal::GetRepHi(rhs)
- : time_internal::GetRepHi(lhs) == (std::numeric_limits<int64_t>::min)()
- ? time_internal::GetRepLo(lhs) + 1 <
- time_internal::GetRepLo(rhs) + 1
- : time_internal::GetRepLo(lhs) < time_internal::GetRepLo(rhs);
+ : time_internal::GetRepHi(lhs) == (std::numeric_limits<int64_t>::min)()
+ ? time_internal::GetRepLo(lhs) + 1 <
+ time_internal::GetRepLo(rhs) + 1
+ : time_internal::GetRepLo(lhs) < time_internal::GetRepLo(rhs);
}
constexpr bool operator==(Duration lhs, Duration rhs) {
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time_zone/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time_zone/ya.make
index d7e1dc0c26..ea9d25cd34 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/time_zone/ya.make
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/time_zone/ya.make
@@ -2,13 +2,13 @@
LIBRARY()
-WITHOUT_LICENSE_TEXTS()
-
-OWNER(
- somov
- g:cpp-contrib
-)
+WITHOUT_LICENSE_TEXTS()
+OWNER(
+ somov
+ g:cpp-contrib
+)
+
LICENSE(Apache-2.0)
ADDINCL(
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/time/ya.make b/contrib/restricted/abseil-cpp-tstring/y_absl/time/ya.make
index 37cc779265..c511d7a8f0 100644
--- a/contrib/restricted/abseil-cpp-tstring/y_absl/time/ya.make
+++ b/contrib/restricted/abseil-cpp-tstring/y_absl/time/ya.make
@@ -2,18 +2,18 @@
LIBRARY()
-OWNER(
- somov
- g:cpp-contrib
-)
-
-LICENSE(
- Apache-2.0 AND
- Public-Domain
-)
-
-LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-
+OWNER(
+ somov
+ g:cpp-contrib
+)
+
+LICENSE(
+ Apache-2.0 AND
+ Public-Domain
+)
+
+LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
+
PEERDIR(
contrib/restricted/abseil-cpp-tstring/y_absl/base
contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/raw_logging