Lines Matching defs:sp

160 static void     gmtload(struct state * sp);
162 struct tm * tmp, struct state * sp); // android-changed: added sp.
164 struct tm * tmp, struct state * sp); // android-changed: added sp.
177 int_fast32_t, struct state * sp); // android-changed: added sp.
181 int_fast32_t offset, int * okayp, struct state * sp); // android-changed: added sp.
185 int_fast32_t offset, int * okayp, int do_norm_secs, struct state * sp); // android-change: added sp.
187 const struct state * sp, struct tm * tmp);
193 static int typesequiv(const struct state * sp, int a, int b);
194 static int tzload(const char * name, struct state * sp,
196 static int tzparse(const char * name, struct state * sp,
270 register struct state * const sp = lclptr;
281 if (sp == NULL) {
288 for (i = 0; i < sp->typecnt; ++i) {
289 register const struct ttinfo * const ttisp = &sp->ttis[i];
291 tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind];
293 for (i = 0; i < sp->timecnt; ++i) {
295 &sp->ttis[
296 sp->types[i]];
299 &sp->chars[ttisp->tt_abbrind];
315 for (i = 0; i < sp->charcnt; ++i)
316 if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL)
317 sp->chars[i] = TZ_ABBR_ERR_CHAR;
321 for (i = 0; i < sp->typecnt; ++i) {
322 register const struct ttinfo * const ttisp = &sp->ttis[i];
323 register char * cp = &sp->chars[ttisp->tt_abbrind];
342 tzload(register const char* name, register struct state* const sp,
353 2 * sizeof *sp +
386 sp->goback = sp->goahead = FALSE;
409 sp->leapcnt = (int) detzcode(up->tzhead.tzh_leapcnt);
410 sp->timecnt = (int) detzcode(up->tzhead.tzh_timecnt);
411 sp->typecnt = (int) detzcode(up->tzhead.tzh_typecnt);
412 sp->charcnt = (int) detzcode(up->tzhead.tzh_charcnt);
414 if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
415 sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
416 sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
417 sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
418 (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
419 (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
422 sp->timecnt * stored + /* ats */
423 sp->timecnt + /* types */
424 sp->typecnt * 6 + /* ttinfos */
425 sp->charcnt + /* chars */
426 sp->leapcnt * (stored + 4) + /* lsinfos */
431 for (i = 0; i < sp->timecnt; ++i) {
434 sp->types[i] = ((TYPE_SIGNED(time_t)
438 if (sp->types[i]) {
445 sp->types[i - 1] = 1;
446 sp->ats[timecnt++] = time_t_min;
448 sp->ats[timecnt++] = at;
453 for (i = 0; i < sp->timecnt; ++i) {
455 if (sp->typecnt <= typ)
457 if (sp->types[i])
458 sp->types[timecnt++] = typ;
460 sp->timecnt = timecnt;
461 for (i = 0; i < sp->typecnt; ++i) {
464 ttisp = &sp->ttis[i];
472 ttisp->tt_abbrind > sp->charcnt)
475 for (i = 0; i < sp->charcnt; ++i)
476 sp->chars[i] = *p++;
477 sp->chars[i] = '\0'; /* ensure '\0' at end */
478 for (i = 0; i < sp->leapcnt; ++i) {
481 lsisp = &sp->lsis[i];
488 for (i = 0; i < sp->typecnt; ++i) {
491 ttisp = &sp->ttis[i];
501 for (i = 0; i < sp->typecnt; ++i) {
504 ttisp = &sp->ttis[i];
530 sp->typecnt + 2 <= TZ_MAX_TYPES) {
537 sp->charcnt + ts->charcnt <= TZ_MAX_CHARS) {
540 sp->charcnt;
542 sp->chars[sp->charcnt++] =
547 sp->ats[sp->timecnt - 1])
550 sp->timecnt < TZ_MAX_TIMES) {
551 sp->ats[sp->timecnt] =
553 sp->types[sp->timecnt] =
554 sp->typecnt +
556 ++sp->timecnt;
559 sp->ttis[sp->typecnt++] = ts->ttis[0];
560 sp->ttis[sp->typecnt++] = ts->ttis[1];
563 if (sp->timecnt > 1) {
564 for (i = 1; i < sp->timecnt; ++i)
565 if (typesequiv(sp, sp->types[i], sp->types[0]) &&
566 differ_by_repeat(sp->ats[i], sp->ats[0])) {
567 sp->goback = TRUE;
570 for (i = sp->timecnt - 2; i >= 0; --i)
571 if (typesequiv(sp, sp->types[sp->timecnt - 1],
572 sp->types[i]) &&
573 differ_by_repeat(sp->ats[sp->timecnt - 1],
574 sp->ats[i])) {
575 sp->goahead = TRUE;
583 for (i = 0; i < sp->typecnt; ++i)
584 if (sp->types[i] == 0)
586 i = (i >= sp->typecnt) ? 0 : -1;
594 if (i < 0 && sp->timecnt > 0 && sp->ttis[sp->types[0]].tt_isdst) {
595 i = sp->types[0];
597 if (!sp->ttis[i].tt_isdst)
606 while (sp->ttis[i].tt_isdst)
607 if (++i >= sp->typecnt) {
612 sp->defaulttype = i;
625 typesequiv(const struct state *const sp, const int a, const int b)
629 if (sp == NULL ||
630 a < 0 || a >= sp->typecnt ||
631 b < 0 || b >= sp->typecnt)
634 register const struct ttinfo * ap = &sp->ttis[a];
635 register const struct ttinfo * bp = &sp->ttis[b];
640 strcmp(&sp->chars[ap->tt_abbrind],
641 &sp->chars[bp->tt_abbrind]) == 0;
935 tzparse(const char * name, register struct state * const sp,
952 if (stdlen >= sizeof sp->chars)
953 stdlen = (sizeof sp->chars) - 1;
974 load_result = tzload(TZDEFRULES, sp, FALSE);
976 sp->leapcnt = 0; /* so, we're off a little */
1014 sp->typecnt = 2; /* standard time and DST */
1018 sp->ttis[0] = sp->ttis[1] = zttinfo;
1019 sp->ttis[0].tt_gmtoff = -dstoffset;
1020 sp->ttis[0].tt_isdst = 1;
1021 sp->ttis[0].tt_abbrind = stdlen + 1;
1022 sp->ttis[1].tt_gmtoff = -stdoffset;
1023 sp->ttis[1].tt_isdst = 0;
1024 sp->ttis[1].tt_abbrind = 0;
1025 sp->defaulttype = 0;
1050 sp->ats[timecnt] = janfirst;
1052 (&sp->ats[timecnt], starttime))
1054 sp->types[timecnt++] = reversed;
1055 sp->ats[timecnt] = janfirst;
1057 (&sp->ats[timecnt], endtime))
1059 sp->types[timecnt++] = !reversed;
1064 sp->timecnt = timecnt;
1066 sp->typecnt = 1; /* Perpetual DST. */
1081 for (i = 0; i < sp->timecnt; ++i) {
1082 j = sp->types[i];
1083 if (!sp->ttis[j].tt_isdst) {
1085 -sp->ttis[j].tt_gmtoff;
1090 for (i = 0; i < sp->timecnt; ++i) {
1091 j = sp->types[i];
1092 if (sp->ttis[j].tt_isdst) {
1094 -sp->ttis[j].tt_gmtoff;
1107 for (i = 0; i < sp->timecnt; ++i) {
1108 j = sp->types[i];
1109 sp->types[i] = sp->ttis[j].tt_isdst;
1110 if (sp->ttis[j].tt_ttisgmt) {
1127 if (isdst && !sp->ttis[j].tt_ttisstd) {
1128 sp->ats[i] += dstoffset -
1131 sp->ats[i] += stdoffset -
1135 theiroffset = -sp->ttis[j].tt_gmtoff;
1136 if (sp->ttis[j].tt_isdst)
1143 sp->ttis[0] = sp->ttis[1] = zttinfo;
1144 sp->ttis[0].tt_gmtoff = -stdoffset;
1145 sp->ttis[0].tt_isdst = FALSE;
1146 sp->ttis[0].tt_abbrind = 0;
1147 sp->ttis[1].tt_gmtoff = -dstoffset;
1148 sp->ttis[1].tt_isdst = TRUE;
1149 sp->ttis[1].tt_abbrind = stdlen + 1;
1150 sp->typecnt = 2;
1151 sp->defaulttype = 0;
1155 sp->typecnt = 1; /* only standard time */
1156 sp->timecnt = 0;
1157 sp->ttis[0] = zttinfo;
1158 sp->ttis[0].tt_gmtoff = -stdoffset;
1159 sp->ttis[0].tt_isdst = 0;
1160 sp->ttis[0].tt_abbrind = 0;
1161 sp->defaulttype = 0;
1163 sp->charcnt = stdlen + 1;
1165 sp->charcnt += dstlen + 1;
1166 if ((size_t) sp->charcnt > sizeof sp->chars)
1168 cp = sp->chars;
1180 gmtload(struct state * const sp)
1182 if (tzload(gmt, sp, TRUE) != 0)
1183 (void) tzparse(gmt, sp, TRUE);
1286 struct tm * const tmp, struct state * sp) // android-changed: added sp.
1293 // BEGIN android-changed: support user-supplied sp.
1294 if (sp == NULL) {
1295 sp = lclptr;
1298 if (sp == NULL)
1299 return gmtsub(timep, offset, tmp, sp); // android-changed: added sp.
1300 if ((sp->goback && t < sp->ats[0]) ||
1301 (sp->goahead && t > sp->ats[sp->timecnt - 1])) {
1306 if (t < sp->ats[0])
1307 seconds = sp->ats[0] - t;
1308 else seconds = t - sp->ats[sp->timecnt - 1];
1312 if (t < sp->ats[0])
1315 if (newt < sp->ats[0] ||
1316 newt > sp->ats[sp->timecnt - 1])
1318 result = localsub(&newt, offset, tmp, sp); // android-changed: added sp.
1323 if (t < sp->ats[0])
1332 if (sp->timecnt == 0 || t < sp->ats[0]) {
1333 i = sp->defaulttype;
1336 register int hi = sp->timecnt;
1341 if (t < sp->ats[mid])
1345 i = (int) sp->types[lo - 1];
1347 ttisp = &sp->ttis[i];
1352 ** timesub(&t, 0L, sp, tmp);
1354 result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
1356 tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
1358 tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
1392 struct tm *const tmp, struct state * sp __unused) // android-changed: added sp.
1464 register const struct state *const sp,
1479 i = (sp == NULL) ? 0 : sp->leapcnt;
1481 lp = &sp->lsis[i];
1485 lp->ls_corr > sp->lsis[i - 1].ls_corr);
1488 sp->lsis[i].ls_trans ==
1489 sp->lsis[i - 1].ls_trans + 1 &&
1490 sp->lsis[i].ls_corr ==
1491 sp->lsis[i - 1].ls_corr + 1) {
1717 const int do_norm_secs, struct state * sp) // android-changed: added sp
1815 if ((*funcp)(&t, offset, &mytm, sp) == NULL) { // android-changed: added sp.
1850 // BEGIN android-changed: support user-supplied sp
1851 if (sp == NULL) {
1852 sp = (struct state *)
1856 if (sp == NULL)
1858 for (i = sp->typecnt - 1; i >= 0; --i) {
1859 if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
1861 for (j = sp->typecnt - 1; j >= 0; --j) {
1862 if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
1864 newt = t + sp->ttis[j].tt_gmtoff -
1865 sp->ttis[i].tt_gmtoff;
1866 if ((*funcp)(&newt, offset, &mytm, sp) == NULL) // android-changed: added sp.
1886 if ((*funcp)(&t, offset, tmp, sp)) // android-changed: added sp.
1893 struct tm * (*const funcp)(const time_t *, int_fast32_t, struct tm *, struct state *), // android-changed: added sp.
1895 int *const okayp, struct state* sp) // android-changed: added sp.
1904 t = time2sub(tmp, funcp, offset, okayp, FALSE, sp);
1905 return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE, sp);
1910 struct tm * (* const funcp) (const time_t *, int_fast32_t, struct tm *, struct state *), // android-changed: added sp.
1911 const int_fast32_t offset, struct state * sp) // android-changed: added sp.
1928 t = time2(tmp, funcp, offset, &okay, sp); // android-changed: added sp.
1946 // BEGIN android-changed: support user-supplied sp.
1947 if (sp == NULL) {
1948 sp = (struct state *) ((funcp == localsub) ? lclptr : gmtptr);
1951 if (sp == NULL)
1953 for (i = 0; i < sp->typecnt; ++i)
1956 for (i = sp->timecnt - 1; i >= 0; --i)
1957 if (!seen[sp->types[i]]) {
1958 seen[sp->types[i]] = TRUE;
1959 types[nseen++] = sp->types[i];
1963 if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
1967 if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
1969 tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
1970 sp->ttis[samei].tt_gmtoff;
1972 t = time2(tmp, funcp, offset, &okay, sp); // android-changed: added sp.
1975 tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
1976 sp->ttis[samei].tt_gmtoff;
2063 register struct state * sp;
2067 sp = lclptr;
2068 i = sp->leapcnt;
2070 lp = &sp->lsis[i];
2268 static int __bionic_tzload_cached(const char* name, struct state* const sp, const int doextend) {
2277 *sp = g_cached_time_zone;
2283 int rc = tzload(name, sp, doextend);
2288 g_cached_time_zone = *sp;