time_zone_fixed.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_FIXED_H_
16 #define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_
17 
18 #include <string>
19 
21 
22 namespace absl {
23 namespace time_internal {
24 namespace cctz {
25 
26 // Helper functions for dealing with the names and abbreviations
27 // of time zones that are a fixed offset (seconds east) from UTC.
28 // FixedOffsetFromName() extracts the offset from a valid fixed-offset
29 // name, while FixedOffsetToName() and FixedOffsetToAbbr() generate
30 // the canonical zone name and abbreviation respectively for the given
31 // offset.
32 //
33 // A fixed-offset name looks like "Fixed/UTC<+-><hours>:<mins>:<secs>".
34 // Its abbreviation is of the form "UTC(<+->H?H(MM(SS)?)?)?" where the
35 // optional pieces are omitted when their values are zero. (Note that
36 // the sign is the opposite of that used in a POSIX TZ specification.)
37 //
38 // Note: FixedOffsetFromName() fails on syntax errors or when the parsed
39 // offset exceeds 24 hours. FixedOffsetToName() and FixedOffsetToAbbr()
40 // both produce "UTC" when the argument offset exceeds 24 hours.
41 bool FixedOffsetFromName(const std::string& name, seconds* offset);
42 std::string FixedOffsetToName(const seconds& offset);
43 std::string FixedOffsetToAbbr(const seconds& offset);
44 
45 } // namespace cctz
46 } // namespace time_internal
47 } // namespace absl
48 
49 #endif // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_
std::string FixedOffsetToAbbr(const seconds &offset)
std::chrono::duration< std::int_fast64_t > seconds
Definition: time_zone.h:37
Definition: algorithm.h:29
char name[1]
Definition: mutex.cc:296
std::string FixedOffsetToName(const seconds &offset)
bool FixedOffsetFromName(const std::string &name, seconds *offset)


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