summaryrefslogtreecommitdiff
path: root/absl/time/internal/cctz/src/time_zone_impl.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-06-29 14:00:35 -0700
committerGravatar Titus Winters <titus@google.com>2018-07-02 09:58:35 -0400
commit134496a31d8b324f762de3bee9a002658c984456 (patch)
treeeb3d81ec6bb667c8f360e6898411a275a19f46c5 /absl/time/internal/cctz/src/time_zone_impl.h
parentba8d6cf07766263723e86736f20a51c1c9c67b19 (diff)
Export of internal Abseil changes.
-- aa9e2bff92652605b8244677058be787c872f99c by Abseil Team <absl-team@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 202702969 -- d26c857c203589892a84bc44d789f2a15a60f234 by Abseil Team <absl-team@google.com>: Cleans up the FixedArray code (formatting, renames, etc) without changing the functionality PiperOrigin-RevId: 202538159 GitOrigin-RevId: aa9e2bff92652605b8244677058be787c872f99c Change-Id: I6561257232c6cc8e1cbf51d7e26bae5f8760551e
Diffstat (limited to 'absl/time/internal/cctz/src/time_zone_impl.h')
-rw-r--r--absl/time/internal/cctz/src/time_zone_impl.h38
1 files changed, 16 insertions, 22 deletions
diff --git a/absl/time/internal/cctz/src/time_zone_impl.h b/absl/time/internal/cctz/src/time_zone_impl.h
index fef7f226..14965ef5 100644
--- a/absl/time/internal/cctz/src/time_zone_impl.h
+++ b/absl/time/internal/cctz/src/time_zone_impl.h
@@ -37,15 +37,15 @@ class time_zone::Impl {
// some other kind of error occurs. Note that loading "UTC" never fails.
static bool LoadTimeZone(const std::string& name, time_zone* tz);
- // Dereferences the time_zone to obtain its Impl.
- static const time_zone::Impl& get(const time_zone& tz);
-
// Clears the map of cached time zones. Primarily for use in benchmarks
// that gauge the performance of loading/parsing the time-zone data.
static void ClearTimeZoneMapTestOnly();
// The primary key is the time-zone ID (e.g., "America/New_York").
- const std::string& name() const { return name_; }
+ const std::string& Name() const {
+ // TODO: It would nice if the zoneinfo data included the zone name.
+ return name_;
+ }
// Breaks a time_point down to civil-time components in this time zone.
time_zone::absolute_lookup BreakTime(const time_point<seconds>& tp) const {
@@ -59,28 +59,22 @@ class time_zone::Impl {
return zone_->MakeTime(cs);
}
- // Returns an implementation-specific description of this time zone.
- std::string Description() const { return zone_->Description(); }
-
// Finds the time of the next/previous offset change in this time zone.
- //
- // By definition, NextTransition(&tp) returns false when tp has its
- // maximum value, and PrevTransition(&tp) returns false when tp has its
- // mimimum value. If the zone has no transitions, the result will also
- // be false no matter what the argument.
- //
- // Otherwise, when tp has its mimimum value, NextTransition(&tp) returns
- // true and sets tp to the first recorded transition. Chains of calls
- // to NextTransition()/PrevTransition() will eventually return false,
- // but it is unspecified exactly when NextTransition(&tp) jumps to false,
- // or what time is set by PrevTransition(&tp) for a very distant tp.
- bool NextTransition(time_point<seconds>* tp) const {
- return zone_->NextTransition(tp);
+ bool NextTransition(const time_point<seconds>& tp,
+ time_zone::civil_transition* trans) const {
+ return zone_->NextTransition(tp, trans);
}
- bool PrevTransition(time_point<seconds>* tp) const {
- return zone_->PrevTransition(tp);
+ bool PrevTransition(const time_point<seconds>& tp,
+ time_zone::civil_transition* trans) const {
+ return zone_->PrevTransition(tp, trans);
}
+ // Returns an implementation-defined version std::string for this time zone.
+ std::string Version() const { return zone_->Version(); }
+
+ // Returns an implementation-defined description of this time zone.
+ std::string Description() const { return zone_->Description(); }
+
private:
explicit Impl(const std::string& name);
static const Impl* UTCImpl();