Definition at line 936 of file localtime.c.
937{
938 const char *stdname;
939 const char *dstname = NULL;
940 size_t stdlen;
941 size_t dstlen;
945 char *cp;
946 bool load_ok;
947
949 if (lastditch)
950 {
951
952 stdlen = strlen(
name);
954 stdoffset = 0;
955 }
956 else
957 {
959 {
964 return false;
965 stdlen =
name - stdname;
967 }
968 else
969 {
971 stdlen =
name - stdname;
972 }
974 return false;
977 return false;
978 }
981 return false;
982
983
984
985
986
987
988
989
990
991
992 load_ok = false;
995
997 {
999 {
1003 return false;
1004 dstlen =
name - dstname;
1006 }
1007 else
1008 {
1011 dstlen =
name - dstname;
1012 }
1013 if (!dstlen)
1014 return false;
1017 return false;
1019 {
1022 return false;
1023 }
1024 else
1026 if (*
name ==
'\0' && !load_ok)
1029 {
1032 int year;
1033 int yearlim;
1036 int32 janoffset = 0;
1037 int yearbeg;
1038
1041 return false;
1043 return false;
1045 return false;
1047 return false;
1049
1050
1051
1052
1057 janfirst = 0;
1059
1060 do
1061 {
1064
1065 yearbeg--;
1067 {
1068 janoffset = -yearsecs;
1069 break;
1070 }
1072
1074 for (year = yearbeg; year < yearlim; year++)
1075 {
1078 endtime =
transtime(year, &end, dstoffset);
1082 bool reversed = endtime < starttime;
1083
1084 if (reversed)
1085 {
1086 int32 swap = starttime;
1087
1088 starttime = endtime;
1089 endtime = swap;
1090 }
1091 if (reversed
1092 || (starttime < endtime
1093 && (endtime - starttime
1094 < (yearsecs
1095 + (stdoffset - dstoffset)))))
1096 {
1098 break;
1102 janoffset + starttime))
1107 janoffset + endtime))
1108 {
1111 }
1112 }
1114 (&janfirst, janoffset + yearsecs))
1115 break;
1116 janoffset = 0;
1117 }
1120 {
1123 }
1126 }
1127 else
1128 {
1129 int32 theirstdoffset;
1130 int32 theirdstoffset;
1132 bool isdst;
1135
1137 return false;
1138
1139
1140
1141
1142 theirstdoffset = 0;
1144 {
1147 {
1148 theirstdoffset =
1150 break;
1151 }
1152 }
1153 theirdstoffset = 0;
1155 {
1158 {
1159 theirdstoffset =
1161 break;
1162 }
1163 }
1164
1165
1166
1167
1168 isdst = false;
1169 theiroffset = theirstdoffset;
1170
1171
1172
1173
1174
1176 {
1180 {
1181
1182 }
1183 else
1184 {
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1197 {
1198 sp->
ats[
i] += dstoffset -
1199 theirdstoffset;
1200 }
1201 else
1202 {
1203 sp->
ats[
i] += stdoffset -
1204 theirstdoffset;
1205 }
1206 }
1209 theirdstoffset = theiroffset;
1210 else
1211 theirstdoffset = theiroffset;
1212 }
1213
1214
1215
1216
1221 }
1222 }
1223 else
1224 {
1225 dstlen = 0;
1230 }
1233 memcpy(cp, stdname, stdlen);
1234 cp += stdlen;
1235 *cp++ = '\0';
1236 if (dstlen != 0)
1237 {
1238 memcpy(cp, dstname, dstlen);
1239 *(cp + dstlen) = '\0';
1240 }
1241 return true;
1242}
if(TABLE==NULL||TABLE_index==NULL)
static const char * getqzname(const char *strp, const int delim)
static int32 transtime(const int year, const struct rule *const rulep, const int32 offset)
static bool increment_overflow_time(pg_time_t *tp, int32 j)
static void init_ttinfo(struct ttinfo *s, int32 utoff, bool isdst, int desigidx)
static const char * getzname(const char *strp)
static const char * getoffset(const char *strp, int32 *const offsetp)
static const int year_lengths[2]
static const char * getrule(const char *strp, struct rule *const rulep)
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]
References state::ats, state::charcnt, charcnt, state::chars, state::defaulttype, EPOCH_YEAR, getoffset(), getqzname(), getrule(), getzname(), state::goahead, state::goback, i, if(), increment_overflow_time(), init_ttinfo(), isleap, j, state::leapcnt, name, SECSPERDAY, SECSPERHOUR, start, state::timecnt, timecnt, transtime(), ttinfo::tt_isdst, ttinfo::tt_ttisstd, ttinfo::tt_ttisut, ttinfo::tt_utoff, state::ttis, state::typecnt, state::types, TZ_MAX_TIMES, TZDEFRULESTRING, year_lengths, and YEARSPERREPEAT.
Referenced by gmtload(), pg_load_tz(), pg_tzset(), and tzloadbody().