00001 // Copyright 2016 Google Inc. All Rights Reserved. 00002 // 00003 // Licensed under the Apache License, Version 2.0 (the "License"); 00004 // you may not use this file except in compliance with the License. 00005 // You may obtain a copy of the License at 00006 // 00007 // https://www.apache.org/licenses/LICENSE-2.0 00008 // 00009 // Unless required by applicable law or agreed to in writing, software 00010 // distributed under the License is distributed on an "AS IS" BASIS, 00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 // See the License for the specific language governing permissions and 00013 // limitations under the License. 00014 00015 #ifndef ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_ 00016 #define ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_ 00017 00018 #include <string> 00019 00020 #include "absl/time/internal/cctz/include/cctz/time_zone.h" 00021 00022 namespace absl { 00023 namespace time_internal { 00024 namespace cctz { 00025 00026 // Helper functions for dealing with the names and abbreviations 00027 // of time zones that are a fixed offset (seconds east) from UTC. 00028 // FixedOffsetFromName() extracts the offset from a valid fixed-offset 00029 // name, while FixedOffsetToName() and FixedOffsetToAbbr() generate 00030 // the canonical zone name and abbreviation respectively for the given 00031 // offset. 00032 // 00033 // A fixed-offset name looks like "Fixed/UTC<+-><hours>:<mins>:<secs>". 00034 // Its abbreviation is of the form "UTC(<+->H?H(MM(SS)?)?)?" where the 00035 // optional pieces are omitted when their values are zero. (Note that 00036 // the sign is the opposite of that used in a POSIX TZ specification.) 00037 // 00038 // Note: FixedOffsetFromName() fails on syntax errors or when the parsed 00039 // offset exceeds 24 hours. FixedOffsetToName() and FixedOffsetToAbbr() 00040 // both produce "UTC" when the argument offset exceeds 24 hours. 00041 bool FixedOffsetFromName(const std::string& name, seconds* offset); 00042 std::string FixedOffsetToName(const seconds& offset); 00043 std::string FixedOffsetToAbbr(const seconds& offset); 00044 00045 } // namespace cctz 00046 } // namespace time_internal 00047 } // namespace absl 00048 00049 #endif // ABSL_TIME_INTERNAL_CCTZ_TIME_ZONE_FIXED_H_