| 1 | /* Time internal interface |
| 2 | |
| 3 | Copyright 2015-2022 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as |
| 7 | published by the Free Software Foundation, either version 3 of the |
| 8 | License, or (at your option) any later version. |
| 9 | |
| 10 | This file is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public License |
| 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | /* Written by Paul Eggert. */ |
| 19 | |
| 20 | /* A time zone rule. */ |
| 21 | struct tm_zone |
| 22 | { |
| 23 | /* More abbreviations, should they be needed. Their TZ_IS_SET |
| 24 | members are zero. */ |
| 25 | struct tm_zone *next; |
| 26 | |
| 27 | #if HAVE_TZNAME && !HAVE_STRUCT_TM_TM_ZONE |
| 28 | /* Copies of recent strings taken from tzname[0] and tzname[1]. |
| 29 | The copies are in ABBRS, so that they survive tzset. Null if unknown. */ |
| 30 | char *tzname_copy[2]; |
| 31 | #endif |
| 32 | |
| 33 | /* If nonzero, the rule represents the TZ environment variable set |
| 34 | to the first "abbreviation" (this may be the empty string). |
| 35 | Otherwise, it represents an unset TZ. */ |
| 36 | char tz_is_set; |
| 37 | |
| 38 | /* A sequence of null-terminated strings packed next to each other. |
| 39 | The strings are followed by an extra null byte. If TZ_IS_SET, |
| 40 | there must be at least one string and the first string (which is |
| 41 | actually a TZ environment value) may be empty. Otherwise all |
| 42 | strings must be nonempty. |
| 43 | |
| 44 | Abbreviations are stored here because otherwise the values of |
| 45 | tm_zone and/or tzname would be dead after changing TZ and calling |
| 46 | tzset. Abbreviations never move once allocated, and are live |
| 47 | until tzfree is called. */ |
| 48 | char abbrs[FLEXIBLE_ARRAY_MEMBER]; |
| 49 | }; |