• Home
  • Raw
  • Download

Lines Matching refs:sp

220 ttunspecified(struct state const *sp, int i)  in ttunspecified()  argument
222 char const *abbr = &sp->chars[sp->ttis[i].tt_desigidx]; in ttunspecified()
274 update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp) in update_tzname_etc() argument
277 tzname[ttisp->tt_isdst] = (char *) &sp->chars[ttisp->tt_desigidx]; in update_tzname_etc()
294 may_update_tzname_etc(int stddst_mask, struct state *sp, int type) in may_update_tzname_etc() argument
296 struct ttinfo *ttisp = &sp->ttis[type]; in may_update_tzname_etc()
299 update_tzname_etc(sp, ttisp); in may_update_tzname_etc()
300 if (!ttunspecified(sp, type)) in may_update_tzname_etc()
309 register struct state * const sp = lclptr; in settzname() local
318 tzname[0] = tzname[1] = (char *) (sp ? wildabbr : utc); in settzname()
332 if (sp) { in settzname()
333 for (i = sp->timecnt - 1; stddst_mask && 0 <= i; i--) in settzname()
334 stddst_mask = may_update_tzname_etc(stddst_mask, sp, sp->types[i]); in settzname()
335 for (i = sp->typecnt - 1; stddst_mask && 0 <= i; i--) in settzname()
336 stddst_mask = may_update_tzname_etc(stddst_mask, sp, i); in settzname()
347 scrub_abbrs(struct state *sp) in scrub_abbrs() argument
352 for (i = 0; i < sp->charcnt - (TZNAME_MAXIMUM + 1); ) { in scrub_abbrs()
353 int len = strlen(&sp->chars[i]); in scrub_abbrs()
360 for (i = 0; i < sp->charcnt; ++i) in scrub_abbrs()
361 if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL) in scrub_abbrs()
362 sp->chars[i] = TZ_ABBR_ERR_CHAR; in scrub_abbrs()
408 tzloadbody(char const *name, struct state *sp, bool doextend, in tzloadbody() argument
423 sp->goback = sp->goahead = false; in tzloadbody()
533 sp->leapcnt = leapcnt; in tzloadbody()
534 sp->timecnt = timecnt; in tzloadbody()
535 sp->typecnt = typecnt; in tzloadbody()
536 sp->charcnt = charcnt; in tzloadbody()
542 for (i = 0; i < sp->timecnt; ++i) { in tzloadbody()
545 sp->types[i] = at <= TIME_T_MAX; in tzloadbody()
546 if (sp->types[i]) { in tzloadbody()
550 if (timecnt && attime <= sp->ats[timecnt - 1]) { in tzloadbody()
551 if (attime < sp->ats[timecnt - 1]) in tzloadbody()
553 sp->types[i - 1] = 0; in tzloadbody()
556 sp->ats[timecnt++] = attime; in tzloadbody()
562 for (i = 0; i < sp->timecnt; ++i) { in tzloadbody()
564 if (sp->typecnt <= typ) in tzloadbody()
566 if (sp->types[i]) in tzloadbody()
567 sp->types[timecnt++] = typ; in tzloadbody()
569 sp->timecnt = timecnt; in tzloadbody()
570 for (i = 0; i < sp->typecnt; ++i) { in tzloadbody()
574 ttisp = &sp->ttis[i]; in tzloadbody()
582 if (! (desigidx < sp->charcnt)) in tzloadbody()
586 for (i = 0; i < sp->charcnt; ++i) in tzloadbody()
587 sp->chars[i] = *p++; in tzloadbody()
590 memset(&sp->chars[i], 0, CHARS_EXTRA); in tzloadbody()
594 for (i = 0; i < sp->leapcnt; ++i) { in tzloadbody()
619 sp->lsis[leapcnt].ls_trans = tr; in tzloadbody()
620 sp->lsis[leapcnt].ls_corr = corr; in tzloadbody()
624 sp->leapcnt = leapcnt; in tzloadbody()
626 for (i = 0; i < sp->typecnt; ++i) { in tzloadbody()
629 ttisp = &sp->ttis[i]; in tzloadbody()
638 for (i = 0; i < sp->typecnt; ++i) { in tzloadbody()
641 ttisp = &sp->ttis[i]; in tzloadbody()
661 sp->typecnt + 2 <= TZ_MAX_TYPES) { in tzloadbody()
665 if (tzparse(&up->buf[1], ts, sp)) { in tzloadbody()
675 int charcnt = sp->charcnt; in tzloadbody()
680 if (strcmp(sp->chars + j, tsabbr) == 0) { in tzloadbody()
688 strcpy(sp->chars + j, tsabbr); in tzloadbody()
696 sp->charcnt = charcnt; in tzloadbody()
701 while (1 < sp->timecnt in tzloadbody()
702 && (sp->types[sp->timecnt - 1] in tzloadbody()
703 == sp->types[sp->timecnt - 2])) in tzloadbody()
704 sp->timecnt--; in tzloadbody()
707 i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES; in tzloadbody()
710 if (increment_overflow_time(&t, leapcorr(sp, t)) in tzloadbody()
711 || (0 < sp->timecnt in tzloadbody()
712 && t <= sp->ats[sp->timecnt - 1])) in tzloadbody()
714 sp->ats[sp->timecnt] = t; in tzloadbody()
715 sp->types[sp->timecnt] = (sp->typecnt in tzloadbody()
717 sp->timecnt++; in tzloadbody()
720 sp->ttis[sp->typecnt++] = ts->ttis[i]; in tzloadbody()
724 if (sp->typecnt == 0) in tzloadbody()
726 if (sp->timecnt > 1) { in tzloadbody()
727 if (sp->ats[0] <= TIME_T_MAX - SECSPERREPEAT) { in tzloadbody()
728 time_t repeatat = sp->ats[0] + SECSPERREPEAT; in tzloadbody()
729 int repeattype = sp->types[0]; in tzloadbody()
730 for (i = 1; i < sp->timecnt; ++i) in tzloadbody()
731 if (sp->ats[i] == repeatat in tzloadbody()
732 && typesequiv(sp, sp->types[i], repeattype)) { in tzloadbody()
733 sp->goback = true; in tzloadbody()
737 if (TIME_T_MIN + SECSPERREPEAT <= sp->ats[sp->timecnt - 1]) { in tzloadbody()
738 time_t repeatat = sp->ats[sp->timecnt - 1] - SECSPERREPEAT; in tzloadbody()
739 int repeattype = sp->types[sp->timecnt - 1]; in tzloadbody()
740 for (i = sp->timecnt - 2; i >= 0; --i) in tzloadbody()
741 if (sp->ats[i] == repeatat in tzloadbody()
742 && typesequiv(sp, sp->types[i], repeattype)) { in tzloadbody()
743 sp->goahead = true; in tzloadbody()
763 for (i = 0; i < sp->timecnt; ++i) in tzloadbody()
764 if (sp->types[i] == 0) in tzloadbody()
766 i = i < sp->timecnt && ! ttunspecified(sp, 0) ? -1 : 0; in tzloadbody()
774 if (i < 0 && sp->timecnt > 0 && sp->ttis[sp->types[0]].tt_isdst) { in tzloadbody()
775 i = sp->types[0]; in tzloadbody()
777 if (!sp->ttis[i].tt_isdst) in tzloadbody()
789 while (sp->ttis[i].tt_isdst) in tzloadbody()
790 if (++i >= sp->typecnt) { in tzloadbody()
799 sp->defaulttype = i; in tzloadbody()
807 tzload(char const *name, struct state *sp, bool doextend) in tzload() argument
814 int err = tzloadbody(name, sp, doextend, lsp); in tzload()
820 return tzloadbody(name, sp, doextend, &ls); in tzload()
825 typesequiv(const struct state *sp, int a, int b) in typesequiv() argument
829 if (sp == NULL || in typesequiv()
830 a < 0 || a >= sp->typecnt || in typesequiv()
831 b < 0 || b >= sp->typecnt) in typesequiv()
838 register const struct ttinfo * ap = &sp->ttis[a]; in typesequiv()
839 register const struct ttinfo * bp = &sp->ttis[b]; in typesequiv()
842 && (strcmp(&sp->chars[ap->tt_desigidx], in typesequiv()
843 &sp->chars[bp->tt_desigidx]) in typesequiv()
1148 tzparse(const char *name, struct state *sp, struct state *basep) in tzparse() argument
1182 sp->leapcnt = basep->leapcnt; in tzparse()
1183 memcpy(sp->lsis, basep->lsis, sp->leapcnt * sizeof *sp->lsis); in tzparse()
1185 load_ok = tzload(TZDEFRULES, sp, false) == 0; in tzparse()
1187 sp->leapcnt = 0; /* So, we're off a little. */ in tzparse()
1189 if (0 < sp->leapcnt) in tzparse()
1190 leaplo = sp->lsis[sp->leapcnt - 1].ls_trans; in tzparse()
1232 sp->typecnt = 2; /* standard time and DST */ in tzparse()
1236 init_ttinfo(&sp->ttis[0], -stdoffset, false, 0); in tzparse()
1237 init_ttinfo(&sp->ttis[1], -dstoffset, true, stdlen + 1); in tzparse()
1238 sp->defaulttype = 0; in tzparse()
1288 sp->ats[timecnt] = janfirst; in tzparse()
1290 (&sp->ats[timecnt], in tzparse()
1292 && atlo <= sp->ats[timecnt]) in tzparse()
1293 sp->types[timecnt++] = !reversed; in tzparse()
1294 sp->ats[timecnt] = janfirst; in tzparse()
1296 (&sp->ats[timecnt], in tzparse()
1298 && atlo <= sp->ats[timecnt]) { in tzparse()
1299 sp->types[timecnt++] = reversed; in tzparse()
1313 sp->timecnt = timecnt; in tzparse()
1315 sp->ttis[0] = sp->ttis[1]; in tzparse()
1316 sp->typecnt = 1; /* Perpetual DST. */ in tzparse()
1318 sp->goback = sp->goahead = true; in tzparse()
1333 for (i = 0; i < sp->timecnt; ++i) { in tzparse()
1334 j = sp->types[i]; in tzparse()
1335 if (!sp->ttis[j].tt_isdst) { in tzparse()
1337 - sp->ttis[j].tt_utoff; in tzparse()
1342 for (i = 0; i < sp->timecnt; ++i) { in tzparse()
1343 j = sp->types[i]; in tzparse()
1344 if (sp->ttis[j].tt_isdst) { in tzparse()
1346 - sp->ttis[j].tt_utoff; in tzparse()
1358 for (i = 0; i < sp->timecnt; ++i) { in tzparse()
1359 j = sp->types[i]; in tzparse()
1360 sp->types[i] = sp->ttis[j].tt_isdst; in tzparse()
1361 if (sp->ttis[j].tt_ttisut) { in tzparse()
1379 if (isdst && !sp->ttis[j].tt_ttisstd) { in tzparse()
1380 sp->ats[i] += dstoffset - in tzparse()
1383 sp->ats[i] += stdoffset - in tzparse()
1387 theiroffset = -sp->ttis[j].tt_utoff; in tzparse()
1388 if (sp->ttis[j].tt_isdst) in tzparse()
1395 init_ttinfo(&sp->ttis[0], -stdoffset, false, 0); in tzparse()
1396 init_ttinfo(&sp->ttis[1], -dstoffset, true, stdlen + 1); in tzparse()
1397 sp->typecnt = 2; in tzparse()
1398 sp->defaulttype = 0; in tzparse()
1402 sp->typecnt = 1; /* only standard time */ in tzparse()
1403 sp->timecnt = 0; in tzparse()
1404 init_ttinfo(&sp->ttis[0], -stdoffset, false, 0); in tzparse()
1405 sp->defaulttype = 0; in tzparse()
1407 sp->charcnt = charcnt; in tzparse()
1408 cp = sp->chars; in tzparse()
1420 gmtload(struct state *const sp) in gmtload() argument
1422 if (tzload(etc_utc, sp, true) != 0) in gmtload()
1423 tzparse("UTC0", sp, NULL); in gmtload()
1429 zoneinit(struct state *sp, char const *name) in zoneinit() argument
1435 sp->leapcnt = 0; /* so, we're off a little */ in zoneinit()
1436 sp->timecnt = 0; in zoneinit()
1437 sp->typecnt = 0; in zoneinit()
1438 sp->charcnt = 0; in zoneinit()
1439 sp->goback = sp->goahead = false; in zoneinit()
1440 init_ttinfo(&sp->ttis[0], 0, false, 0); in zoneinit()
1441 strcpy(sp->chars, utc); in zoneinit()
1442 sp->defaulttype = 0; in zoneinit()
1445 int err = tzload(name, sp, true); in zoneinit()
1446 if (err != 0 && name && name[0] != ':' && tzparse(name, sp, NULL)) in zoneinit()
1449 err = scrub_abbrs(sp); in zoneinit()
1457 struct state *sp = lclptr; in tzsetlcl() local
1464 if (! sp) in tzsetlcl()
1465 lclptr = sp = malloc(sizeof *lclptr); in tzsetlcl()
1467 if (sp) { in tzsetlcl()
1468 if (zoneinit(sp, name) != 0) in tzsetlcl()
1469 zoneinit(sp, ""); in tzsetlcl()
1518 timezone_t sp = malloc(sizeof *sp); in tzalloc() local
1519 if (sp) { in tzalloc()
1520 int err = zoneinit(sp, name); in tzalloc()
1522 free(sp); in tzalloc()
1528 return sp; in tzalloc()
1532 tzfree(timezone_t sp) in tzfree() argument
1534 free(sp); in tzfree()
1565 localsub(struct state const *sp, time_t const *timep, int_fast32_t setname, in localsub() argument
1573 if (sp == NULL) { in localsub()
1577 if ((sp->goback && t < sp->ats[0]) || in localsub()
1578 (sp->goahead && t > sp->ats[sp->timecnt - 1])) { in localsub()
1583 if (t < sp->ats[0]) in localsub()
1584 seconds = sp->ats[0] - t; in localsub()
1585 else seconds = t - sp->ats[sp->timecnt - 1]; in localsub()
1593 if (t < sp->ats[0]) in localsub()
1598 if (newt < sp->ats[0] || in localsub()
1599 newt > sp->ats[sp->timecnt - 1]) in localsub()
1601 result = localsub(sp, &newt, setname, tmp); in localsub()
1604 if (t < sp->ats[0] in localsub()
1614 if (t < sp->ats[0]) in localsub()
1624 if (sp->timecnt == 0 || t < sp->ats[0]) { in localsub()
1625 i = sp->defaulttype; in localsub()
1628 register int hi = sp->timecnt; in localsub()
1633 if (t < sp->ats[mid]) in localsub()
1637 i = sp->types[lo - 1]; in localsub()
1639 ttisp = &sp->ttis[i]; in localsub()
1646 result = timesub(&t, ttisp->tt_utoff, sp, tmp); in localsub()
1650 result->TM_ZONE = (char *) &sp->chars[ttisp->tt_desigidx]; in localsub()
1653 update_tzname_etc(sp, ttisp); in localsub()
1661 localtime_rz(struct state *restrict sp, time_t const *restrict timep, in localtime_rz() argument
1664 return localsub(sp, timep, 0, tmp); in localtime_rz()
1710 gmtsub(ATTRIBUTE_MAYBE_UNUSED struct state const *sp, time_t const *timep, in gmtsub() argument
1784 const struct state *sp, struct tm *tmp) in timesub() argument
1800 i = (sp == NULL) ? 0 : sp->leapcnt; in timesub()
1802 lp = &sp->lsis[i]; in timesub()
2031 struct state const *sp, in time2sub() argument
2131 if (! funcp(sp, &t, offset, &mytm)) { in time2sub()
2177 if (funcp(sp, &altt, offset, &alttm) in time2sub()
2195 if (sp == NULL) in time2sub()
2197 for (i = sp->typecnt - 1; i >= 0; --i) { in time2sub()
2198 if (sp->ttis[i].tt_isdst != yourtm.tm_isdst) in time2sub()
2200 for (j = sp->typecnt - 1; j >= 0; --j) { in time2sub()
2201 if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) in time2sub()
2203 if (ttunspecified(sp, j)) in time2sub()
2205 newt = (t + sp->ttis[j].tt_utoff in time2sub()
2206 - sp->ttis[i].tt_utoff); in time2sub()
2207 if (! funcp(sp, &newt, offset, &mytm)) in time2sub()
2227 if (funcp(sp, &t, offset, tmp)) in time2sub()
2236 struct state const *sp, in time2() argument
2247 t = time2sub(tmp, funcp, sp, offset, okayp, false); in time2()
2248 return *okayp ? t : time2sub(tmp, funcp, sp, offset, okayp, true); in time2()
2255 struct state const *sp, in time1() argument
2273 t = time2(tmp, funcp, sp, offset, &okay); in time1()
2291 if (sp == NULL) in time1()
2293 for (i = 0; i < sp->typecnt; ++i) in time1()
2296 for (i = sp->timecnt - 1; i >= 0; --i) in time1()
2297 if (!seen[sp->types[i]] && !ttunspecified(sp, sp->types[i])) { in time1()
2298 seen[sp->types[i]] = true; in time1()
2299 types[nseen++] = sp->types[i]; in time1()
2303 if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) in time1()
2307 if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) in time1()
2309 tmp->tm_sec += (sp->ttis[otheri].tt_utoff in time1()
2310 - sp->ttis[samei].tt_utoff); in time1()
2312 t = time2(tmp, funcp, sp, offset, &okay); in time1()
2315 tmp->tm_sec -= (sp->ttis[otheri].tt_utoff in time1()
2316 - sp->ttis[samei].tt_utoff); in time1()
2324 mktime_tzname(struct state *sp, struct tm *tmp, bool setname) in mktime_tzname() argument
2326 if (sp) in mktime_tzname()
2327 return time1(tmp, localsub, sp, setname); in mktime_tzname()
2337 mktime_z(struct state *restrict sp, struct tm *restrict tmp) in mktime_z() argument
2339 return mktime_tzname(sp, tmp, false); in mktime_z()
2401 leapcorr(struct state const *sp, time_t t) in leapcorr() argument
2406 i = sp->leapcnt; in leapcorr()
2408 lp = &sp->lsis[i]; in leapcorr()
2438 time2posix_z(struct state *sp, time_t t) in time2posix_z() argument
2440 return t - leapcorr(sp, t); in time2posix_z()
2460 posix2time_z(struct state *sp, time_t t) in posix2time_z() argument
2470 x = t + leapcorr(sp, t); in posix2time_z()
2471 y = x - leapcorr(sp, x); in posix2time_z()
2475 y = x - leapcorr(sp, x); in posix2time_z()
2481 y = x - leapcorr(sp, x); in posix2time_z()