about summary refs log tree commit diff
path: root/absl/time/internal
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-10T19·31-0700
committerCJ Johnson <johnsoncj@google.com>2018-10-10T19·35-0400
commitf340f773edab951656b19b6f1a77c964a78ec4c2 (patch)
treec42bf7faf49fb2355661c9f39c40513bc1ff2697 /absl/time/internal
parent445998d7ac4e5d3c50411d377e3b50e960d2d6c2 (diff)
Export of internal Abseil changes.
--
906c47420646d510edd2479d5542c56f5fa31b65 by CJ Johnson <johnsoncj@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 216573923

--
74560d4afd2b605909e677c6fc3076049fb3010a by Eric Fiselier <ericwf@google.com>:

Avoid -Wformat-pedantic in benchmark.

PiperOrigin-RevId: 216523769

--
9bcc9da8b03e6d1ea43ee78931256c5541cb9686 by Eric Fiselier <ericwf@google.com>:

Delete unused CityHash functions.

PiperOrigin-RevId: 216464492

--
a42563b394c89fbb4c55cb5a6a5edbf96d271eea by Abseil Team <absl-team@google.com>:

Introduce new Abseil interfaces for converting between civil
times and absolute times.s

Deprecates absl::ConvertDateTime() and absl::FromDateTime().

PiperOrigin-RevId: 216424948

--
088e11235124267517d7f137854fa5554679c24f by Eric Fiselier <ericwf@google.com>:

Remove unneeded break statements in test.

PiperOrigin-RevId: 216403321
GitOrigin-RevId: 906c47420646d510edd2479d5542c56f5fa31b65
Change-Id: Idb44420be623e369c66f5a9c92bdc9ab46d3ec92
Diffstat (limited to 'absl/time/internal')
-rw-r--r--absl/time/internal/cctz/src/time_zone_posix.h40
-rw-r--r--absl/time/internal/test_util.cc6
-rw-r--r--absl/time/internal/test_util.h24
3 files changed, 25 insertions, 45 deletions
diff --git a/absl/time/internal/cctz/src/time_zone_posix.h b/absl/time/internal/cctz/src/time_zone_posix.h
index 9ccd4a8b68bd..ef2a8c1647db 100644
--- a/absl/time/internal/cctz/src/time_zone_posix.h
+++ b/absl/time/internal/cctz/src/time_zone_posix.h
@@ -68,25 +68,35 @@ namespace cctz {
 // it would take us to another day, and perhaps week, or even month.
 struct PosixTransition {
   enum DateFormat { J, N, M };
-  struct {
+
+  struct Date {
+    struct NonLeapDay {
+      std::int_fast16_t day;  // day of non-leap year [1:365]
+    };
+    struct Day {
+      std::int_fast16_t day;  // day of year [0:365]
+    };
+    struct MonthWeekWeekday {
+      std::int_fast8_t month;    // month of year [1:12]
+      std::int_fast8_t week;     // week of month [1:5] (5==last)
+      std::int_fast8_t weekday;  // 0==Sun, ..., 6=Sat
+    };
+
     DateFormat fmt;
+
     union {
-      struct {
-        std::int_fast16_t day;  // day of non-leap year [1:365]
-      } j;
-      struct {
-        std::int_fast16_t day;  // day of year [0:365]
-      } n;
-      struct {
-        std::int_fast8_t month;    // month of year [1:12]
-        std::int_fast8_t week;     // week of month [1:5] (5==last)
-        std::int_fast8_t weekday;  // 0==Sun, ..., 6=Sat
-      } m;
+      NonLeapDay j;
+      Day n;
+      MonthWeekWeekday m;
     };
-  } date;
-  struct {
+  };
+
+  struct Time {
     std::int_fast32_t offset;  // seconds before/after 00:00:00
-  } time;
+  };
+
+  Date date;
+  Time time;
 };
 
 // The entirety of a POSIX-string specified time-zone rule. The standard
diff --git a/absl/time/internal/test_util.cc b/absl/time/internal/test_util.cc
index bbbef7da70c4..4483f2a977e5 100644
--- a/absl/time/internal/test_util.cc
+++ b/absl/time/internal/test_util.cc
@@ -26,12 +26,6 @@ namespace cctz = absl::time_internal::cctz;
 namespace absl {
 namespace time_internal {
 
-#if GTEST_USES_SIMPLE_RE
-extern const char kZoneAbbrRE[] = ".*";  // just punt
-#else
-extern const char kZoneAbbrRE[] = "[A-Za-z]{3,4}|[-+][0-9]{2}([0-9]{2})?";
-#endif
-
 TimeZone LoadTimeZone(const std::string& name) {
   TimeZone tz;
   ABSL_RAW_CHECK(LoadTimeZone(name, &tz), name.c_str());
diff --git a/absl/time/internal/test_util.h b/absl/time/internal/test_util.h
index 8fd5fb9fd038..d99402934c67 100644
--- a/absl/time/internal/test_util.h
+++ b/absl/time/internal/test_util.h
@@ -17,35 +17,11 @@
 
 #include <string>
 
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
 #include "absl/time/time.h"
 
-// This helper is a macro so that failed expectations show up with the
-// correct line numbers.
-//
-// This is for internal testing of the Base Time library itself. This is not
-// part of a public API.
-#define ABSL_INTERNAL_EXPECT_TIME(bd, y, m, d, h, min, s, off, isdst)     \
-  do {                                                                    \
-    EXPECT_EQ(y, bd.year);                                                \
-    EXPECT_EQ(m, bd.month);                                               \
-    EXPECT_EQ(d, bd.day);                                                 \
-    EXPECT_EQ(h, bd.hour);                                                \
-    EXPECT_EQ(min, bd.minute);                                            \
-    EXPECT_EQ(s, bd.second);                                              \
-    EXPECT_EQ(off, bd.offset);                                            \
-    EXPECT_EQ(isdst, bd.is_dst);                                          \
-    EXPECT_THAT(bd.zone_abbr,                                             \
-                testing::MatchesRegex(absl::time_internal::kZoneAbbrRE)); \
-  } while (0)
-
 namespace absl {
 namespace time_internal {
 
-// A regular expression that matches all zone abbreviations (%Z).
-extern const char kZoneAbbrRE[];
-
 // Loads the named timezone, but dies on any failure.
 absl::TimeZone LoadTimeZone(const std::string& name);