• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/Libc-1044.1.2/stdtime/FreeBSD/

Lines Matching refs:sp

213 static void		gmtload(struct state * sp, char *path);
215 static void gmtload(struct state * sp);
253 const struct state * sp, struct tm * tmp);
256 const struct state * sp, struct tm * tmp);
263 static int tzload(const char * name, struct state * sp, char *path);
265 static int tzload(const char * name, struct state * sp);
267 static int tzparse(const char * name, struct state * sp,
371 struct state * sp = lclptr;
389 if (sp == NULL) {
401 if (sp->timecnt == 0 && sp->typecnt == 1) {
412 i = sp->timecnt - 1;
413 types = sp->types;
417 const struct ttinfo * const ttisp = &sp->ttis[types[i]];
428 tzname[1] = &sp->chars[ttisp->tt_abbrind];
435 tzname[0] = &sp->chars[ttisp->tt_abbrind];
554 tzload(name, sp, path)
556 tzload(name, sp)
559 struct state * const sp;
632 char buf[sizeof *sp + sizeof *tzhp];
645 sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
646 sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
647 sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
648 sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
650 if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
651 sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
652 sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
653 sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
654 (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
655 (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
657 if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */
658 sp->timecnt + /* types */
659 sp->typecnt * (4 + 2) + /* ttinfos */
660 sp->charcnt + /* chars */
661 sp->leapcnt * (4 + 4) + /* lsinfos */
665 for (i = 0; i < sp->timecnt; ++i) {
666 sp->ats[i] = detzcode(p);
669 for (i = 0; i < sp->timecnt; ++i) {
670 sp->types[i] = (unsigned char) *p++;
671 if (sp->types[i] >= sp->typecnt)
674 for (i = 0; i < sp->typecnt; ++i) {
677 ttisp = &sp->ttis[i];
685 ttisp->tt_abbrind > sp->charcnt)
688 for (i = 0; i < sp->charcnt; ++i)
689 sp->chars[i] = *p++;
690 sp->chars[i] = '\0'; /* ensure '\0' at end */
691 for (i = 0; i < sp->leapcnt; ++i) {
694 lsisp = &sp->lsis[i];
700 for (i = 0; i < sp->typecnt; ++i) {
703 ttisp = &sp->ttis[i];
713 for (i = 0; i < sp->typecnt; ++i) {
716 ttisp = &sp->ttis[i];
1026 tzparse(name, sp, lastditch)
1028 struct state * const sp;
1047 if (stdlen >= sizeof sp->chars)
1048 stdlen = (sizeof sp->chars) - 1;
1063 load_result = tzload(TZDEFRULES, sp, NULL);
1065 load_result = tzload(TZDEFRULES, sp);
1068 sp->leapcnt = 0; /* so, we're off a little */
1098 sp->typecnt = 2; /* standard time and DST */
1102 sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
1103 if (sp->timecnt > TZ_MAX_TIMES)
1105 sp->ttis[0].tt_gmtoff = -dstoffset;
1106 sp->ttis[0].tt_isdst = 1;
1107 sp->ttis[0].tt_abbrind = stdlen + 1;
1108 sp->ttis[1].tt_gmtoff = -stdoffset;
1109 sp->ttis[1].tt_isdst = 0;
1110 sp->ttis[1].tt_abbrind = 0;
1111 atp = sp->ats;
1112 typep = sp->types;
1147 for (i = 0; i < sp->timecnt; ++i) {
1148 j = sp->types[i];
1149 if (!sp->ttis[j].tt_isdst) {
1151 -sp->ttis[j].tt_gmtoff;
1156 for (i = 0; i < sp->timecnt; ++i) {
1157 j = sp->types[i];
1158 if (sp->ttis[j].tt_isdst) {
1160 -sp->ttis[j].tt_gmtoff;
1173 for (i = 0; i < sp->timecnt; ++i) {
1174 j = sp->types[i];
1175 sp->types[i] = sp->ttis[j].tt_isdst;
1176 if (sp->ttis[j].tt_ttisgmt) {
1193 if (isdst && !sp->ttis[j].tt_ttisstd) {
1194 sp->ats[i] += dstoffset -
1197 sp->ats[i] += stdoffset -
1201 theiroffset = -sp->ttis[j].tt_gmtoff;
1202 if (sp->ttis[j].tt_isdst)
1210 sp->ttis[0].tt_gmtoff = -stdoffset;
1211 sp->ttis[0].tt_isdst = FALSE;
1212 sp->ttis[0].tt_abbrind = 0;
1213 sp->ttis[1].tt_gmtoff = -dstoffset;
1214 sp->ttis[1].tt_isdst = TRUE;
1215 sp->ttis[1].tt_abbrind = stdlen + 1;
1216 sp->typecnt = 2;
1220 sp->typecnt = 1; /* only standard time */
1221 sp->timecnt = 0;
1222 sp->ttis[0].tt_gmtoff = -stdoffset;
1223 sp->ttis[0].tt_isdst = 0;
1224 sp->ttis[0].tt_abbrind = 0;
1226 sp->charcnt = stdlen + 1;
1228 sp->charcnt += dstlen + 1;
1229 if ((size_t) sp->charcnt > sizeof sp->chars)
1231 cp = sp->chars;
1244 gmtload(sp, path)
1246 gmtload(sp)
1248 struct state * const sp;
1254 if (tzload(gmt, sp, path) != 0)
1256 if (tzload(gmt, sp) != 0)
1258 (void) tzparse(gmt, sp, TRUE);
1461 struct state * sp;
1469 sp = lclptr;
1471 if (sp == NULL) {
1480 if (sp->timecnt == 0 || t < sp->ats[0]) {
1482 while (sp->ttis[i].tt_isdst)
1483 if (++i >= sp->typecnt) {
1488 for (i = 1; i < sp->timecnt; ++i)
1489 if (t < sp->ats[i])
1491 i = sp->types[i - 1];
1493 ttisp = &sp->ttis[i];
1498 ** timesub(&t, 0L, sp, tmp);
1501 if (timesub(&t, ttisp->tt_gmtoff, sp, tmp) == NULL)
1504 timesub(&t, ttisp->tt_gmtoff, sp, tmp);
1507 tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
1509 tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
1742 timesub(timep, offset, sp, tmp)
1745 const struct state * const sp;
1761 i = (sp == NULL) ? 0 : sp->leapcnt;
1764 i = sp->leapcnt;
1767 lp = &sp->lsis[i];
1771 lp->ls_corr > sp->lsis[i - 1].ls_corr);
1774 sp->lsis[i].ls_trans ==
1775 sp->lsis[i - 1].ls_trans + 1 &&
1776 sp->lsis[i].ls_corr ==
1777 sp->lsis[i - 1].ls_corr + 1) {
1986 const struct state * sp;
2144 sp = (funcp == localsub) ? lclptr : gmtptr;
2145 if (unix03 && sp->typecnt == 1 && yourtm.tm_isdst > 0)
2156 if (sp == NULL)
2159 for (i = sp->typecnt - 1; i >= 0; --i) {
2160 if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
2162 for (j = sp->typecnt - 1; j >= 0; --j) {
2163 if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
2165 newt = t + sp->ttis[j].tt_gmtoff -
2166 sp->ttis[i].tt_gmtoff;
2236 const struct state * sp;
2267 sp = (funcp == localsub) ? lclptr : gmtptr;
2269 if (sp == NULL)
2272 for (i = 0; i < sp->typecnt; ++i)
2275 for (i = sp->timecnt - 1; i >= 0; --i)
2276 if (!seen[sp->types[i]]) {
2277 seen[sp->types[i]] = TRUE;
2278 types[nseen++] = sp->types[i];
2282 if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
2286 if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
2288 tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
2289 sp->ttis[samei].tt_gmtoff;
2294 tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
2295 sp->ttis[samei].tt_gmtoff;
2387 struct state * sp;
2391 sp = lclptr;
2392 i = sp->leapcnt;
2394 lp = &sp->lsis[i];