summaryrefslogtreecommitdiff
path: root/absl/time/internal/cctz/src/time_zone_if.cc
diff options
context:
space:
mode:
authorGravatar Gennadiy Rozental <rogeeff@google.com>2023-06-27 17:22:39 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-06-27 17:24:09 -0700
commitd65595c8dd994b47b7fdfdf9427bb546c577467b (patch)
treeb28691c7a8d04c6236dfe9f1b17bf6ac3ca85310 /absl/time/internal/cctz/src/time_zone_if.cc
parente6c09ae4b2acd421a29706f86e66eaa422262ad0 (diff)
Import of CCTZ from GitHub.
PiperOrigin-RevId: 543896343 Change-Id: Ia91b3e082b764b750bbbe9a3ce63192263d51438
Diffstat (limited to 'absl/time/internal/cctz/src/time_zone_if.cc')
-rw-r--r--absl/time/internal/cctz/src/time_zone_if.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/absl/time/internal/cctz/src/time_zone_if.cc b/absl/time/internal/cctz/src/time_zone_if.cc
index 1d44dde7..0e65cd9e 100644
--- a/absl/time/internal/cctz/src/time_zone_if.cc
+++ b/absl/time/internal/cctz/src/time_zone_if.cc
@@ -23,19 +23,19 @@ ABSL_NAMESPACE_BEGIN
namespace time_internal {
namespace cctz {
-std::unique_ptr<TimeZoneIf> TimeZoneIf::Load(const std::string& name) {
+std::unique_ptr<TimeZoneIf> TimeZoneIf::UTC() { return TimeZoneInfo::UTC(); }
+
+std::unique_ptr<TimeZoneIf> TimeZoneIf::Make(const std::string& name) {
// Support "libc:localtime" and "libc:*" to access the legacy
// localtime and UTC support respectively from the C library.
// NOTE: The "libc:*" zones are internal, test-only interfaces, and
// are subject to change/removal without notice. Do not use them.
if (name.compare(0, 5, "libc:") == 0) {
- return std::unique_ptr<TimeZoneIf>(new TimeZoneLibC(name.substr(5)));
+ return TimeZoneLibC::Make(name.substr(5));
}
- // Otherwise use the "zoneinfo" implementation by default.
- std::unique_ptr<TimeZoneInfo> tz(new TimeZoneInfo);
- if (!tz->Load(name)) tz.reset();
- return std::unique_ptr<TimeZoneIf>(tz.release());
+ // Otherwise use the "zoneinfo" implementation.
+ return TimeZoneInfo::Make(name);
}
// Defined out-of-line to avoid emitting a weak vtable in all TUs.