tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

time_zone_if.cc (1686B)


      1 // Copyright 2016 Google Inc. All Rights Reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //   https://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 //   Unless required by applicable law or agreed to in writing, software
     10 //   distributed under the License is distributed on an "AS IS" BASIS,
     11 //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 //   See the License for the specific language governing permissions and
     13 //   limitations under the License.
     14 
     15 #include "absl/time/internal/cctz/src/time_zone_if.h"
     16 
     17 #include "absl/base/config.h"
     18 #include "absl/time/internal/cctz/src/time_zone_info.h"
     19 #include "absl/time/internal/cctz/src/time_zone_libc.h"
     20 
     21 namespace absl {
     22 ABSL_NAMESPACE_BEGIN
     23 namespace time_internal {
     24 namespace cctz {
     25 
     26 std::unique_ptr<TimeZoneIf> TimeZoneIf::UTC() { return TimeZoneInfo::UTC(); }
     27 
     28 std::unique_ptr<TimeZoneIf> TimeZoneIf::Make(const std::string& name) {
     29  // Support "libc:localtime" and "libc:*" to access the legacy
     30  // localtime and UTC support respectively from the C library.
     31  // NOTE: The "libc:*" zones are internal, test-only interfaces, and
     32  // are subject to change/removal without notice. Do not use them.
     33  if (name.compare(0, 5, "libc:") == 0) {
     34    return TimeZoneLibC::Make(name.substr(5));
     35  }
     36 
     37  // Otherwise use the "zoneinfo" implementation.
     38  return TimeZoneInfo::Make(name);
     39 }
     40 
     41 // Defined out-of-line to avoid emitting a weak vtable in all TUs.
     42 TimeZoneIf::~TimeZoneIf() {}
     43 
     44 }  // namespace cctz
     45 }  // namespace time_internal
     46 ABSL_NAMESPACE_END
     47 }  // namespace absl