Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:29

0001 // Copyright 2016 Google Inc. All Rights Reserved.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //   https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 //   Unless required by applicable law or agreed to in writing, software
0010 //   distributed under the License is distributed on an "AS IS" BASIS,
0011 //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 //   See the License for the specific language governing permissions and
0013 //   limitations under the License.
0014 
0015 #ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
0016 #define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
0017 
0018 #include <memory>
0019 #include <string>
0020 
0021 #include "absl/base/config.h"
0022 #include "time_zone_if.h"
0023 
0024 namespace absl {
0025 ABSL_NAMESPACE_BEGIN
0026 namespace time_internal {
0027 namespace cctz {
0028 
0029 // A time zone backed by gmtime_r(3), localtime_r(3), and mktime(3),
0030 // and which therefore only supports UTC and the local time zone.
0031 class TimeZoneLibC : public TimeZoneIf {
0032  public:
0033   // Factory.
0034   static std::unique_ptr<TimeZoneLibC> Make(const std::string& name);
0035 
0036   // TimeZoneIf implementations.
0037   time_zone::absolute_lookup BreakTime(
0038       const time_point<seconds>& tp) const override;
0039   time_zone::civil_lookup MakeTime(const civil_second& cs) const override;
0040   bool NextTransition(const time_point<seconds>& tp,
0041                       time_zone::civil_transition* trans) const override;
0042   bool PrevTransition(const time_point<seconds>& tp,
0043                       time_zone::civil_transition* trans) const override;
0044   std::string Version() const override;
0045   std::string Description() const override;
0046 
0047  private:
0048   explicit TimeZoneLibC(const std::string& name);
0049   TimeZoneLibC(const TimeZoneLibC&) = delete;
0050   TimeZoneLibC& operator=(const TimeZoneLibC&) = delete;
0051 
0052   const bool local_;  // localtime or UTC
0053 };
0054 
0055 }  // namespace cctz
0056 }  // namespace time_internal
0057 ABSL_NAMESPACE_END
0058 }  // namespace absl
0059 
0060 #endif  // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_