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
This commit is contained in:
Abseil Team 2018-06-29 14:00:35 -07:00 committed by Titus Winters
parent ba8d6cf077
commit 134496a31d
16 changed files with 452 additions and 262 deletions

View file

@ -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();