aboutsummaryrefslogtreecommitdiff
path: root/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-14 01:08:04 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-14 01:08:04 +0000
commit924bd5e397341029a8e680b0865b414109251528 (patch)
tree2ce94d7f0804ccb77d1fa9b2a1bca00eecdff1e2 /third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc
parent6ce7cd2e9d37e544ae827b91153fadda15d355e7 (diff)
parent7563023510bf04108a954596ea9393a4c11ac279 (diff)
downloadwebrtc-android13-tests-release.tar.gz
Change-Id: Ie91f8b8b9ff715203282c2c4b2072b0f702d0631
Diffstat (limited to 'third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc')
-rw-r--r--third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc b/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc
index 47cf84c663..887dd097c6 100644
--- a/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc
+++ b/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc
@@ -27,6 +27,12 @@
#include "absl/time/internal/cctz/include/cctz/civil_time.h"
#include "absl/time/internal/cctz/include/cctz/time_zone.h"
+#if defined(_AIX)
+extern "C" {
+extern long altzone;
+}
+#endif
+
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace time_internal {
@@ -44,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)
+#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;
@@ -153,7 +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;
- if (std::tm* tmp = local_time(&mid, &tm)) {
+ std::tm* tmp = local_time(&mid, &tm);
+ if (tmp != nullptr) {
if (tm_gmtoff(*tmp) == offset) {
hi = mid;
} else {
@@ -163,7 +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) {
- if (std::tm* tmp = local_time(&lo, &tm)) {
+ tmp = local_time(&lo, &tm);
+ if (tmp != nullptr) {
if (tm_gmtoff(*tmp) == offset) break;
}
}
@@ -223,11 +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};
}