time_zone_libc.h
Go to the documentation of this file.
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 #ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
16 #define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
17 
18 #include <string>
19 
20 #include "time_zone_if.h"
21 
22 namespace absl {
23 namespace time_internal {
24 namespace cctz {
25 
26 // A time zone backed by gmtime_r(3), localtime_r(3), and mktime(3),
27 // and which therefore only supports UTC and the local time zone.
28 // TODO: Add support for fixed offsets from UTC.
29 class TimeZoneLibC : public TimeZoneIf {
30  public:
31  explicit TimeZoneLibC(const std::string& name);
32 
33  // TimeZoneIf implementations.
35  const time_point<seconds>& tp) const override;
37  const civil_second& cs) const override;
38  bool NextTransition(const time_point<seconds>& tp,
39  time_zone::civil_transition* trans) const override;
40  bool PrevTransition(const time_point<seconds>& tp,
41  time_zone::civil_transition* trans) const override;
42  std::string Version() const override;
43  std::string Description() const override;
44 
45  private:
46  const bool local_; // localtime or UTC
47 };
48 
49 } // namespace cctz
50 } // namespace time_internal
51 } // namespace absl
52 
53 #endif // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_LIBC_H_
Definition: algorithm.h:29
time_zone::absolute_lookup BreakTime(const time_point< seconds > &tp) const override
bool NextTransition(const time_point< seconds > &tp, time_zone::civil_transition *trans) const override
char name[1]
Definition: mutex.cc:296
std::chrono::time_point< std::chrono::system_clock, D > time_point
Definition: time_zone.h:36
time_zone::civil_lookup MakeTime(const civil_second &cs) const override
std::string Description() const override
std::string Version() const override
bool PrevTransition(const time_point< seconds > &tp, time_zone::civil_transition *trans) const override


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:19:58