938{
939 const char *stdname;
940 const char *dstname = NULL;
941 size_t stdlen;
942 size_t dstlen;
944 int_fast32_t stdoffset;
945 int_fast32_t dstoffset;
946 char *cp;
947 bool load_ok;
948
950 if (lastditch)
951 {
952
953 stdlen = strlen(
name);
955 stdoffset = 0;
956 }
957 else
958 {
960 {
965 return false;
966 stdlen =
name - stdname;
968 }
969 else
970 {
972 stdlen =
name - stdname;
973 }
975 return false;
978 return false;
979 }
982 return false;
983
984
985
986
987
988
989
990
991
992
993 load_ok = false;
996
998 {
1000 {
1004 return false;
1005 dstlen =
name - dstname;
1007 }
1008 else
1009 {
1012 dstlen =
name - dstname;
1013 }
1014 if (!dstlen)
1015 return false;
1018 return false;
1020 {
1023 return false;
1024 }
1025 else
1027 if (*
name ==
'\0' && !load_ok)
1030 {
1033 int year;
1034 int yearlim;
1037 int_fast32_t janoffset = 0;
1038 int yearbeg;
1039
1042 return false;
1044 return false;
1046 return false;
1048 return false;
1050
1051
1052
1053
1058 janfirst = 0;
1060
1061 do
1062 {
1063 int_fast32_t yearsecs
1065
1066 yearbeg--;
1068 {
1069 janoffset = -yearsecs;
1070 break;
1071 }
1073
1075 for (year = yearbeg; year < yearlim; year++)
1076 {
1077 int_fast32_t
1079 endtime =
transtime(year, &end, dstoffset);
1080 int_fast32_t
1083 bool reversed = endtime < starttime;
1084
1085 if (reversed)
1086 {
1087 int_fast32_t swap = starttime;
1088
1089 starttime = endtime;
1090 endtime = swap;
1091 }
1092 if (reversed
1093 || (starttime < endtime
1094 && (endtime - starttime
1095 < (yearsecs
1096 + (stdoffset - dstoffset)))))
1097 {
1099 break;
1103 janoffset + starttime))
1108 janoffset + endtime))
1109 {
1112 }
1113 }
1115 (&janfirst, janoffset + yearsecs))
1116 break;
1117 janoffset = 0;
1118 }
1121 {
1124 }
1127 }
1128 else
1129 {
1130 int_fast32_t theirstdoffset;
1131 int_fast32_t theirdstoffset;
1132 int_fast32_t theiroffset;
1133 bool isdst;
1136
1138 return false;
1139
1140
1141
1142
1143 theirstdoffset = 0;
1145 {
1148 {
1149 theirstdoffset =
1151 break;
1152 }
1153 }
1154 theirdstoffset = 0;
1156 {
1159 {
1160 theirdstoffset =
1162 break;
1163 }
1164 }
1165
1166
1167
1168
1169 isdst = false;
1170 theiroffset = theirstdoffset;
1171
1172
1173
1174
1175
1177 {
1181 {
1182
1183 }
1184 else
1185 {
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1198 {
1199 sp->
ats[
i] += dstoffset -
1200 theirdstoffset;
1201 }
1202 else
1203 {
1204 sp->
ats[
i] += stdoffset -
1205 theirstdoffset;
1206 }
1207 }
1210 theirdstoffset = theiroffset;
1211 else
1212 theirstdoffset = theiroffset;
1213 }
1214
1215
1216
1217
1222 }
1223 }
1224 else
1225 {
1226 dstlen = 0;
1231 }
1234 memcpy(cp, stdname, stdlen);
1235 cp += stdlen;
1236 *cp++ = '\0';
1237 if (dstlen != 0)
1238 {
1239 memcpy(cp, dstname, dstlen);
1240 *(cp + dstlen) = '\0';
1241 }
1242 return true;
1243}
if(TABLE==NULL||TABLE_index==NULL)
static const char * getqzname(const char *strp, const int delim)
static bool increment_overflow_time(pg_time_t *tp, int_fast32_t j)
static void init_ttinfo(struct ttinfo *s, int_fast32_t utoff, bool isdst, int desigidx)
static int_fast32_t transtime(const int year, const struct rule *const rulep, const int_fast32_t offset)
static const char * getzname(const char *strp)
static const int year_lengths[2]
static const char * getrule(const char *strp, struct rule *const rulep)
static const char * getoffset(const char *strp, int_fast32_t *const offsetp)
struct ttinfo ttis[TZ_MAX_TYPES]
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS+1, 4),(2 *(TZ_STRLEN_MAX+1)))]
pg_time_t ats[TZ_MAX_TIMES]
unsigned char types[TZ_MAX_TIMES]