Lines Matching +full:10 +full:base +full:- +full:t1
5 ** 2006-07-17 by Arthur David Olson.
23 * use the -include compiler option to unconditionally include the correct
43 ZIC32_MIN = -1 - (zic_t) 0x7fffffff,
51 /* Minimum and maximum years, assuming signed 32-bit time_t. */
86 /* The minimum alignment of a type, for pre-C23 platforms.
173 return -1; in readlink()
179 return -1; in symlink()
184 (errno = ENOTSUP, -1)
209 static zic_t oadd(zic_t t1, zic_t t2);
216 static zic_t tadd(zic_t t1, zic_t t2);
219 enum { PERCENT_Z_LEN_BOUND = sizeof "+995959" - 1 };
335 (The "+"s pacify gcc -Wenum-compare.) */
418 { "last-Sunday", TM_SUNDAY },
419 { "last-Monday", TM_MONDAY },
420 { "last-Tuesday", TM_TUESDAY },
421 { "last-Wednesday", TM_WEDNESDAY },
422 { "last-Thursday", TM_THURSDAY },
423 { "last-Friday", TM_FRIDAY },
424 { "last-Saturday", TM_SATURDAY },
494 if (a <= INDEX_MAX && b <= INDEX_MAX - a) in size_sum()
518 ptrdiff_t lo_bits = alignment - 1, sum = size_sum(size, lo_bits); in align_to()
567 if (*nitems_alloc <= ((INDEX_MAX - 1) / 3 * 2) / itemsize) { in grow_nitems_alloc()
591 enum { LEAPSEC_FILENUM = -2, COMMAND_LINE_FILENUM = -1 };
601 return strcmp(fname, "-") == 0 ? _("standard input") : fname; in filename()
617 eats(fnum, num, 0, -1); in eat()
625 ** zic ... 2>&1 | error -t "*" -v in verror()
682 _("%s: usage is %s [ --version ] [ --help ] [ -v ] \\\n" in usage()
683 "\t[ -b {slim|fat} ] [ -d directory ] [ -l localtime ]" in usage()
684 " [ -L leapseconds ] \\\n" in usage()
685 "\t[ -p posixrules ] [ -r '[@lo][/@hi]' ] [ -R '@hi' ] \\\n" in usage()
686 "\t[ -t localtime-link ] \\\n" in usage()
721 int cmp = strcmp(l->l_linkname, m->l_linkname); in qsort_linkcmp()
728 cmp = l->l_filenum - m->l_filenum; in qsort_linkcmp()
731 return (l->l_linenum > m->l_linenum) - (l->l_linenum < m->l_linenum); in qsort_linkcmp()
739 return strcmp(key, m->l_linkname); in bsearch_linkcmp()
763 up with a small sorted subsequence of not-yet-made links. in make_links()
766 a link to a not-yet-made link, so the process repeats. in make_links()
771 0 .. (i - 1): in make_links()
775 i .. (j - 1): in make_links()
776 not-yet-made links for this pass in make_links()
777 j .. (nalinks - 1): in make_links()
778 not-yet-made links that this pass has skipped because in make_links()
779 they were links to not-yet-made links in make_links()
783 not alter entries 0 .. (nlinks - 1), which remain sorted. in make_links()
787 short (e.g., 3) though its worst-case value is L. */ in make_links()
798 if (nalinks - i == pass_size) { in make_links()
804 pass_size = nalinks - i; in make_links()
815 l = bsearch(links[i].l_target, &links[i + 1], j - (i + 1), in make_links()
818 l = bsearch(links[i].l_target, &links[j], nalinks - j, in make_links()
830 warning(_("link %s targeting link %s mishandled by pre-2023 zic"), in make_links()
909 the -r option. These default to MIN_TIME and MAX_TIME. */
913 /* The time specified by the -R option, defaulting to MIN_TIME;
918 static zic_t leapexpires = -1;
929 lo = strtoimax(timerange + 1, &lo_end, 10); in timerange_option()
936 hi = strtoimax(lo_end + 2, &hi_end, 10); in timerange_option()
939 hi -= ! (hi == INTMAX_MAX && errno == ERANGE); in timerange_option()
955 redundant = strtoimax(opt + 1, &opt_end, 10); in redundant_time_option()
969 /* -1 if the TZif output file should be slim, 0 if default, 1 if the
1005 _("wild compilation-time specification of zic_t")); in main()
1009 if (strcmp(argv[k], "--version") == 0) { in main()
1013 } else if (strcmp(argv[k], "--help") == 0) { in main()
1017 && c != -1) in main()
1024 error(_("incompatible -b options")); in main()
1025 bloat = -1; in main()
1028 error(_("incompatible -b options")); in main()
1031 error(_("invalid option: -b '%s'"), optarg); in main()
1038 _("%s: More than one -d option" in main()
1049 _("%s: More than one -l option" in main()
1060 _("%s: More than one -p option" in main()
1069 _("%s: More than one -t option" in main()
1077 warning(_("-y ignored")); in main()
1084 _("%s: More than one -L option" in main()
1096 _("%s: More than one -r option" in main()
1117 warning(_("-s ignored")); in main()
1120 if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) in main()
1123 fprintf(stderr, _("%s: -R time exceeds -r cutoff\n"), progname); in main()
1131 bloat = -1; in main()
1156 ** Find the next non-continuation zone entry. in main()
1160 outzone(&zones[i], j - i); in main()
1181 ptrdiff_t component_len = component_end - component; in componentcheck()
1195 && component[0] == '.' && component_end[-1] == '.') { in componentcheck()
1202 if (0 < component_len && component[0] == '-') in componentcheck()
1203 warning(_("file name '%s' component contains leading '-'"), in componentcheck()
1220 "-/_" in namecheck()
1224 /* Non-control chars in the POSIX portable character set, in namecheck()
1260 nwords = s < 0 ? -1 : s / sizeof *entropy_buffer; in get_rand_u64()
1263 return entropy_buffer[--nwords]; in get_rand_u64()
1279 In other cases this code yields a sort-of-random number. */ in get_rand_u64()
1318 enum { prefixlen = sizeof prefix - 1, alphabetlen = sizeof alphabet - 1 }; in random_dirent()
1321 ptrdiff_t dirlen = lastslash ? lastslash + 1 - src : 0; in random_dirent()
1324 uint_fast64_t base = alphabetlen; in random_dirent() local
1326 /* BASE**6 */ in random_dirent()
1327 uint_fast64_t base__6 = base * base * base * base * base * base; in random_dirent()
1329 /* The largest uintmax_t that is a multiple of BASE**6. Any random in random_dirent()
1331 remainder when divided by BASE**6. UNFAIR_MIN equals the in random_dirent()
1332 mathematical value of ((UINTMAX_MAX + 1) - (UINTMAX_MAX + 1) % BASE**6) in random_dirent()
1334 uint_fast64_t unfair_min = - ((UINTMAX_MAX % base__6 + 1) % base__6); in random_dirent()
1423 size_t lenslash = len + (len && directory[len - 1] != '/'); in relname()
1435 dotdots += linkname[i] == '/' && linkname[i - 1] != '/'; in relname()
1467 int targetissym = -2, linknameissym = -2; in dolink()
1471 if (strcmp(target, "-") == 0) { in dolink()
1577 /* Return 1 if NAME is an absolute symbolic link, -1 if it is relative,
1578 0 if it is not a symbolic link. If *CACHE is not -2, it is the
1583 if (*cache == -2) { in itssymlink()
1585 *cache = readlink(name, &c, 1) < 0 ? 0 : c == '/' ? 1 : -1; in itssymlink()
1602 return strcmp(r1->r_name, r2->r_name); in rcomp()
1610 register ptrdiff_t i, j, base, out; in associate() local
1614 for (i = 0; i < nrules - 1; ++i) { in associate()
1635 i = j - 1; in associate()
1640 zp->z_rules = NULL; in associate()
1641 zp->z_nrules = 0; in associate()
1643 for (base = 0; base < nrules; base = out) { in associate()
1644 rp = &rules[base]; in associate()
1645 for (out = base + 1; out < nrules; ++out) in associate()
1646 if (strcmp(rp->r_name, rules[out].r_name) != 0) in associate()
1650 if (strcmp(zp->z_rule, rp->r_name) != 0) in associate()
1652 zp->z_rules = rp; in associate()
1653 zp->z_nrules = out - base; in associate()
1658 if (zp->z_nrules == 0) { in associate()
1662 eat(zp->z_filenum, zp->z_linenum); in associate()
1663 zp->z_save = getsave(zp->z_rule, &zp->z_isdst); in associate()
1668 if (zp->z_format_specifier == 's') in associate()
1717 if (strcmp(name, "-") == 0) { in infile()
1748 else switch (lp->l_value) { in infile()
1779 ** h -h hh:mm -hh:mm hh:mm:ss -hh:mm:ss
1796 if (*string == '-') { in gethms()
1797 sign = -1; in gethms()
1811 " pre-2018 versions of zic")); in gethms()
1834 warning(_("values over 24 hours not handled by pre-2007 versions of zic")); in gethms()
1842 int dst = -1; in getsave()
1846 char *ep = field + fieldlen - 1; in getsave()
1869 case '+': case '-': in inrule()
1900 error(_("\"Zone %s\" line and -l option are mutually exclusive"), in inzone()
1905 error(_("\"Zone %s\" line and -p option are mutually exclusive"), in inzone()
1997 zones[nzones - 1].z_untiltime > min_time && in inzsub()
1998 zones[nzones - 1].z_untiltime < max_time && in inzsub()
1999 zones[nzones - 1].z_untiltime >= z.z_untiltime) { in inzsub()
2009 cp1[cp - fields[i_format]] = 's'; in inzsub()
2011 warning(_("format '%s' not handled by pre-2015 versions of zic"), in inzsub()
2042 return -1; in getleapdatetime()
2057 --j; in getleapdatetime()
2058 i = -len_years[isleap(j)]; in getleapdatetime()
2064 return -1; in getleapdatetime()
2066 month = lp->l_value; in getleapdatetime()
2077 return -1; in getleapdatetime()
2079 dayoff = oadd(dayoff, day - 1); in getleapdatetime()
2082 return -1; in getleapdatetime()
2086 return -1; in getleapdatetime()
2109 if (!fields[LP_CORR][0]) /* infile() turns "-" into "". */ in inleap()
2110 correction = -1; in inleap()
2116 leapadd(t, correction, lp->l_value); in inleap()
2171 rp->r_month = lp->l_value; in rulesub()
2172 rp->r_todisstd = false; in rulesub()
2173 rp->r_todisut = false; in rulesub()
2176 ep = dp + strlen(dp) - 1; in rulesub()
2179 rp->r_todisstd = true; in rulesub()
2180 rp->r_todisut = false; in rulesub()
2184 rp->r_todisstd = false; in rulesub()
2185 rp->r_todisut = false; in rulesub()
2191 rp->r_todisstd = true; in rulesub()
2192 rp->r_todisut = true; in rulesub()
2197 rp->r_tod = gethms(dp, _("invalid time of day")); in rulesub()
2204 if (lp) switch (lp->l_value) { in rulesub()
2208 cp, YEAR_32BIT_MIN - 1); in rulesub()
2209 rp->r_loyear = YEAR_32BIT_MIN - 1; in rulesub()
2212 } else if (sscanf(cp, "%"SCNdZIC"%c", &rp->r_loyear, &xs) != 1) { in rulesub()
2218 rp->r_hiwasnum = lp == NULL; in rulesub()
2219 if (!rp->r_hiwasnum) switch (lp->l_value) { in rulesub()
2221 rp->r_hiyear = ZIC_MAX; in rulesub()
2224 rp->r_hiyear = rp->r_loyear; in rulesub()
2227 } else if (sscanf(cp, "%"SCNdZIC"%c", &rp->r_hiyear, &xs) != 1) { in rulesub()
2231 if (rp->r_loyear > rp->r_hiyear) { in rulesub()
2236 error(_("year type \"%s\" is unsupported; use \"-\" instead"), in rulesub()
2245 ** last-Sunday (undocumented; warn about this) in rulesub()
2251 rp->r_dycode = DC_DOWLEQ; in rulesub()
2252 rp->r_wday = lp->l_value; in rulesub()
2253 rp->r_dayofmonth = len_months[1][rp->r_month]; in rulesub()
2257 rp->r_dycode = DC_DOWLEQ; in rulesub()
2261 rp->r_dycode = DC_DOWGEQ; in rulesub()
2264 rp->r_dycode = DC_DOM; in rulesub()
2267 if (rp->r_dycode != DC_DOM) { in rulesub()
2279 rp->r_wday = lp->l_value; in rulesub()
2281 if (sscanf(ep, "%d%c", &rp->r_dayofmonth, &xs) != 1 || in rulesub()
2282 rp->r_dayofmonth <= 0 || in rulesub()
2283 (rp->r_dayofmonth > len_months[1][rp->r_month])) { in rulesub()
2300 for (i = 0, shift = 24; i < 4; ++i, shift -= 8) in convert()
2311 for (i = 0, shift = 56; i < 8; ++i, shift -= 8) in convert64()
2341 zic_t a = ap->at, b = bp->at; in atcomp()
2342 return a < b ? -1 : a > b; in atcomp()
2347 ptrdiff_t base, count; member
2357 while (0 < r.count && ats[r.base] < lo) { in limitrange()
2358 r.defaulttype = types[r.base]; in limitrange()
2359 r.count--; in limitrange()
2360 r.base++; in limitrange()
2369 r.leapcount--; in limitrange()
2373 && ((corr[r.leapbase - 1] < corr[r.leapbase]) in limitrange()
2376 r.leapbase--; in limitrange()
2382 while (0 < r.count && hi + 1 < ats[r.base + r.count - 1]) in limitrange()
2383 r.count--; in limitrange()
2384 while (0 < r.leapcount && hi + 1 < trans[r.leapbase + r.leapcount - 1]) in limitrange()
2385 r.leapcount--; in limitrange()
2389 r.leapexpiry = 0 <= leapexpires && leapexpires - 1 <= hi; in limitrange()
2430 + utoffs[attypes[toi - 1].type]) in writezone()
2431 <= (attypes[toi - 1].at in writezone()
2433 : attypes[toi - 2].type]))) { in writezone()
2434 attypes[toi - 1].type = in writezone()
2440 || (utoffs[attypes[toi - 1].type] in writezone()
2442 || (isdsts[attypes[toi - 1].type] in writezone()
2444 || (desigidx[attypes[toi - 1].type] in writezone()
2457 warning(_("pre-2014 clients may mishandle" in writezone()
2473 while (--j >= 0) in writezone()
2474 if (ats[i] > trans[j] - corr[j]) { in writezone()
2485 redundant_time - (ZIC_MIN < redundant_time)), in writezone()
2489 /* TZif version 4 is needed if a no-op transition is appended to in writezone()
2491 leap second transition is not to a +1 or -1 correction. */ in writezone()
2496 if (r->leapexpiry) { in writezone()
2498 warning(_("%s: pre-2021b clients may mishandle" in writezone()
2503 if (0 < r->leapcount in writezone()
2504 && corr[r->leapbase] != 1 && corr[r->leapbase] != -1) { in writezone()
2506 warning(_("%s: pre-2021b clients may mishandle" in writezone()
2521 int pretranstype = -1, thisdefaulttype; in writezone()
2535 thistimei = range32.base; in writezone()
2545 thistimei = range64.base; in writezone()
2565 buggy 32-bit clients that do not use time type 0 for in writezone()
2573 /* Arguably the default time type in the 32-bit data in writezone()
2578 ignore 32-bit data, so this discrepancy matters only in writezone()
2581 the historical zic value, unless -r specifies a low in writezone()
2582 cutoff that excludes some 32-bit timestamps. */ in writezone()
2602 ** For some pre-2011 systems: if the last-to-be-written in writezone()
2612 hidst = histd = mrudst = mrustd = -1; in writezone()
2635 isdsts[mrudst] = -1; in writezone()
2646 isdsts[mrustd] = -1; in writezone()
2665 indmap[i] = -1; in writezone()
2690 pretranstype = -1; in writezone()
2720 putc(0, fp); /* empty-string abbreviation */ in writezone()
2772 j = types[j - 1]; in writezone()
2774 todo = tadd(trans[i], -utoffs[j]); in writezone()
2780 /* Append a no-op leap correction indicating when the leap in writezone()
2786 puttzcode(thisleaplim ? corr[thisleaplim - 1] : 0, fp); in writezone()
2810 offset = -offset; in abbroffset()
2811 sign = '-'; in abbroffset()
2824 *p++ = '0' + offset / 10; in abbroffset()
2825 *p++ = '0' + offset % 10; in abbroffset()
2827 *p++ = '0' + minutes / 10; in abbroffset()
2828 *p++ = '0' + minutes % 10; in abbroffset()
2830 *p++ = '0' + seconds / 10; in abbroffset()
2831 *p++ = '0' + seconds % 10; in abbroffset()
2848 char const *format = zp->z_format; in doabbr()
2853 if (zp->z_format_specifier == 'z') in doabbr()
2854 letters = abbroffset(letterbuf, zp->z_stdoff + save); in doabbr()
2863 memcpy(abbr, format, slashp - format); in doabbr()
2864 abbr[slashp - format] = '\0'; in doabbr()
2899 offset = -offset; in stringoffset()
2900 result[0] = '-'; in stringoffset()
2923 register zic_t tod = rp->r_tod; in stringrule()
2926 if (rp->r_dycode == DC_DOM) { in stringrule()
2929 if (rp->r_dayofmonth == 29 && rp->r_month == TM_FEBRUARY) in stringrule()
2930 return -1; in stringrule()
2932 for (month = 0; month < rp->r_month; ++month) in stringrule()
2935 if (rp->r_month <= 1) in stringrule()
2936 result += sprintf(result, "%d", total + rp->r_dayofmonth - 1); in stringrule()
2938 result += sprintf(result, "J%d", total + rp->r_dayofmonth); in stringrule()
2941 register int wday = rp->r_wday; in stringrule()
2944 if (rp->r_dycode == DC_DOWGEQ) { in stringrule()
2945 wdayoff = (rp->r_dayofmonth - 1) % DAYSPERWEEK; in stringrule()
2948 wday -= wdayoff; in stringrule()
2950 week = 1 + (rp->r_dayofmonth - 1) / DAYSPERWEEK; in stringrule()
2951 } else if (rp->r_dycode == DC_DOWLEQ) { in stringrule()
2952 if (rp->r_dayofmonth == len_months[1][rp->r_month]) in stringrule()
2955 wdayoff = rp->r_dayofmonth % DAYSPERWEEK; in stringrule()
2958 wday -= wdayoff; in stringrule()
2960 week = rp->r_dayofmonth / DAYSPERWEEK; in stringrule()
2962 } else return -1; /* "cannot happen" */ in stringrule()
2966 rp->r_month + 1, week, wday); in stringrule()
2968 if (rp->r_todisut) in stringrule()
2970 if (rp->r_todisstd && !rp->r_isdst) in stringrule()
2975 return -1; in stringrule()
2991 return -!!b; in rule_cmp()
2994 if (a->r_hiyear != b->r_hiyear) in rule_cmp()
2995 return a->r_hiyear < b->r_hiyear ? -1 : 1; in rule_cmp()
2996 if (a->r_hiyear == ZIC_MAX) in rule_cmp()
2998 if (a->r_month - b->r_month != 0) in rule_cmp()
2999 return a->r_month - b->r_month; in rule_cmp()
3000 return a->r_dayofmonth - b->r_dayofmonth; in rule_cmp()
3031 return -1; in stringzone()
3033 zp = zpfirst + zonecount - 1; in stringzone()
3034 for (i = 0; i < zp->z_nrules; ++i) { in stringzone()
3037 rp = &zp->z_rules[i]; in stringzone()
3038 last = &lastrp[rp->r_isdst]; in stringzone()
3043 return -1; in stringzone()
3047 dstcmp = zp->z_nrules ? rule_cmp(dstrp, stdrp) : zp->z_isdst ? 1 : -1; in stringzone()
3055 "XXX3EDT4,0/0,J365/23" for EDT (-04) all year. */ in stringzone()
3056 zic_t save = dstrp ? dstrp->r_save : zp->z_save; in stringzone()
3059 /* Positive DST, the typical case for all-year DST. in stringzone()
3063 zstr[0].z_stdoff = zp->z_stdoff + 2 * save; in stringzone()
3067 zstr[1].z_format = zp->z_format; in stringzone()
3068 zstr[1].z_format_specifier = zp->z_format_specifier; in stringzone()
3076 dstr.r_save = save < 0 ? save : -save; in stringzone()
3077 dstr.r_abbrvar = dstrp ? dstrp->r_abbrvar : NULL; in stringzone()
3085 stdr.r_abbrvar = save < 0 && stdrp ? stdrp->r_abbrvar : NULL; in stringzone()
3089 len = doabbr(result, stdzp, stdrp ? stdrp->r_abbrvar : NULL, in stringzone()
3091 offsetlen = stringoffset(result + len, - stdzp->z_stdoff); in stringzone()
3094 return -1; in stringzone()
3099 len += doabbr(result + len, dstzp, dstrp->r_abbrvar, in stringzone()
3100 dstrp->r_isdst, dstrp->r_save, true); in stringzone()
3101 if (dstrp->r_save != SECSPERMIN * MINSPERHOUR) { in stringzone()
3103 - (dstzp->z_stdoff + dstrp->r_save)); in stringzone()
3106 return -1; in stringzone()
3111 c = stringrule(result + len, dstrp, dstrp->r_save, stdzp->z_stdoff); in stringzone()
3114 return -1; in stringzone()
3120 c = stringrule(result + len, stdrp, dstrp->r_save, stdzp->z_stdoff); in stringzone()
3123 return -1; in stringzone()
3146 int nonTZlimtype = -1; in outzone()
3148 int defaulttype = -1; in outzone()
3180 if (i < zonecount - 1) in outzone()
3181 updateminmax(zp->z_untilrule.r_loyear); in outzone()
3182 for (j = 0; j < zp->z_nrules; ++j) { in outzone()
3183 struct rule *rp = &zp->z_rules[j]; in outzone()
3184 updateminmax(rp->r_loyear); in outzone()
3185 if (rp->r_hiwasnum) in outzone()
3186 updateminmax(rp->r_hiyear); in outzone()
3199 zpfirst->z_name); in outzone()
3201 /* Circa-COMPAT clients, and earlier clients, might in outzone()
3204 warning(_("%s: pre-%d clients may mishandle" in outzone()
3206 zpfirst->z_name, compat); in outzone()
3211 min_year -= years_of_observations; in outzone()
3213 if (max_year <= ZIC_MAX - years_of_observations) in outzone()
3223 if (min_year > YEAR_32BIT_MIN - 1) in outzone()
3224 min_year = YEAR_32BIT_MIN - 1; in outzone()
3230 unspecifiedtype = addtype(0, "-00", false, false, false); in outzone()
3238 bool usestart = i > 0 && (zp - 1)->z_untiltime > min_time; in outzone()
3239 bool useuntil = i < (zonecount - 1); in outzone()
3240 zic_t stdoff = zp->z_stdoff; in outzone()
3242 if (useuntil && zp->z_untiltime <= min_time) in outzone()
3244 eat(zp->z_filenum, zp->z_linenum); in outzone()
3246 if (zp->z_nrules == 0) { in outzone()
3248 save = zp->z_save; in outzone()
3249 doabbr(startbuf, zp, NULL, zp->z_isdst, save, false); in outzone()
3250 type = addtype(oadd(zp->z_stdoff, save), in outzone()
3251 startbuf, zp->z_isdst, startttisstd, in outzone()
3265 if (useuntil && year > zp->z_untilrule.r_hiyear) in outzone()
3272 for (j = 0; j < zp->z_nrules; ++j) { in outzone()
3275 struct rule *rp = &zp->z_rules[j]; in outzone()
3276 eats(zp->z_filenum, zp->z_linenum, in outzone()
3277 rp->r_filenum, rp->r_linenum); in outzone()
3278 rp->r_todo = year >= rp->r_loyear && in outzone()
3279 year <= rp->r_hiyear; in outzone()
3280 if (rp->r_todo) { in outzone()
3281 rp->r_temp = rpytime(rp, year); in outzone()
3282 rp->r_todo in outzone()
3283 = (rp->r_temp < y2038_boundary in outzone()
3301 untiltime = zp->z_untiltime; in outzone()
3302 if (!zp->z_untilrule.r_todisut) in outzone()
3304 -stdoff); in outzone()
3305 if (!zp->z_untilrule.r_todisstd) in outzone()
3307 -save); in outzone()
3313 k = -1; in outzone()
3314 for (j = 0; j < zp->z_nrules; ++j) { in outzone()
3315 struct rule *r = &zp->z_rules[j]; in outzone()
3316 if (!r->r_todo) in outzone()
3318 eats(zp->z_filenum, zp->z_linenum, in outzone()
3319 r->r_filenum, r->r_linenum); in outzone()
3320 offset = r->r_todisut ? 0 : stdoff; in outzone()
3321 if (!r->r_todisstd) in outzone()
3323 jtime = r->r_temp; in outzone()
3327 jtime = tadd(jtime, -offset); in outzone()
3334 eats(zp->z_filenum, zp->z_linenum, in outzone()
3335 r->r_filenum, r->r_linenum); in outzone()
3337 r = &zp->z_rules[k]; in outzone()
3338 eats(zp->z_filenum, zp->z_linenum, in outzone()
3339 r->r_filenum, r->r_linenum); in outzone()
3345 rp = &zp->z_rules[k]; in outzone()
3346 rp->r_todo = false; in outzone()
3349 && (oadd(zp->z_stdoff, rp->r_save) in outzone()
3351 doabbr(startbuf, zp, rp->r_abbrvar, in outzone()
3352 rp->r_isdst, rp->r_save, in outzone()
3356 save = rp->r_save; in outzone()
3361 startoff = oadd(zp->z_stdoff, in outzone()
3364 rp->r_abbrvar, in outzone()
3365 rp->r_isdst, in outzone()
3366 rp->r_save, in outzone()
3371 && startoff == oadd(zp->z_stdoff, in outzone()
3375 rp->r_abbrvar, in outzone()
3376 rp->r_isdst, in outzone()
3377 rp->r_save, in outzone()
3381 eats(zp->z_filenum, zp->z_linenum, in outzone()
3382 rp->r_filenum, rp->r_linenum); in outzone()
3383 doabbr(ab, zp, rp->r_abbrvar, in outzone()
3384 rp->r_isdst, rp->r_save, false); in outzone()
3385 offset = oadd(zp->z_stdoff, rp->r_save); in outzone()
3386 type = addtype(offset, ab, rp->r_isdst, in outzone()
3387 rp->r_todisstd, rp->r_todisut); in outzone()
3388 if (defaulttype < 0 && !rp->r_isdst) in outzone()
3392 && (useuntil || rp->r_hiyear != ZIC_MAX)) { in outzone()
3400 bool isdst = startoff != zp->z_stdoff; in outzone()
3401 if (*startbuf == '\0' && zp->z_format) in outzone()
3404 eat(zp->z_filenum, zp->z_linenum); in outzone()
3420 startttisstd = zp->z_untilrule.r_todisstd; in outzone()
3421 startttisut = zp->z_untilrule.r_todisut; in outzone()
3422 starttime = zp->z_untiltime; in outzone()
3424 starttime = tadd(starttime, -save); in outzone()
3426 starttime = tadd(starttime, -stdoff); in outzone()
3446 and not needed for -r or -R. */ in outzone()
3465 ** near the end of the 400-year period, add a redundant in outzone()
3477 if (attypes[i].at > lastat->at) in outzone()
3479 if (!lastat || lastat->at < rpytime(&xr, max_year - 1)) { in outzone()
3481 lastat ? lastat->type : defaulttype); in outzone()
3482 attypes[timecnt - 1].dontmerge = true; in outzone()
3485 writezone(zpfirst->z_name, envvar, version, defaulttype); in outzone()
3506 if (! (-1L - 2147483647L <= utoff && utoff <= 2147483647L)) { in addtype()
3552 error(_("Rolling leap seconds not supported with -r")); in leapadd()
3558 memmove(&trans[i + 1], &trans[i], (leapcnt - i) * sizeof *trans); in leapadd()
3559 memmove(&corr[i + 1], &corr[i], (leapcnt - i) * sizeof *corr); in leapadd()
3560 memmove(&roll[i + 1], &roll[i], (leapcnt - i) * sizeof *roll); in leapadd()
3578 if (trans[i] - prevtrans < 28 * SECSPERDAY) { in adjleap()
3589 if (! (leapcnt == 0 || (trans[leapcnt - 1] < leapexpires))) { in adjleap()
3646 /* case-insensitive equality */
3693 by a non-'-', skip the "last" and look in WDAY_NAMES instead. in byword()
3694 Warn about any usage of the undocumented prefix "last-". */ in byword()
3696 if (word[4] == '-') in byword()
3708 for (lp = table; lp->l_word != NULL; ++lp) in byword()
3709 if (ciequal(word, lp->l_word)) in byword()
3715 for (lp = table; lp->l_word != NULL; ++lp) in byword()
3716 if (ciprefix(word, lp->l_word)) { in byword()
3723 /* Warn about any backward-compatibility issue with pre-2017c zic. */ in byword()
3725 for (lp = table; lp->l_word; lp++) in byword()
3726 if (itsabbr(word, lp->l_word)) { in byword()
3728 warning(_("\"%s\" is ambiguous in pre-2017c zic"), word); in byword()
3770 array[nsubs++] = dstart + (*dstart == '-' && dp == dstart + 1); in getfields()
3783 oadd(zic_t t1, zic_t t2) in oadd() argument
3787 if (!ckd_add(&sum, t1, t2)) in oadd()
3790 if (t1 < 0 ? ZIC_MIN - t1 <= t2 : t2 <= ZIC_MAX - t1) in oadd()
3791 return t1 + t2; in oadd()
3797 tadd(zic_t t1, zic_t t2) in tadd() argument
3801 if (!ckd_add(&sum, t1, t2) && min_time <= sum && sum <= max_time) in tadd()
3804 if (t1 < 0 ? min_time - t1 <= t2 : t2 <= max_time - t1) in tadd()
3805 return t1 + t2; in tadd()
3807 if (t1 == min_time || t1 == max_time) in tadd()
3808 return t1; in tadd()
3832 /* dayoff = floor((wantedy - y) / YEARSPERREPEAT) * DAYSPERREPEAT, in rpytime()
3834 yrem = wantedy % YEARSPERREPEAT - y % YEARSPERREPEAT; in rpytime()
3835 dayoff = ((wantedy / YEARSPERREPEAT - y / YEARSPERREPEAT in rpytime()
3836 + yrem / YEARSPERREPEAT - (yrem % YEARSPERREPEAT < 0)) in rpytime()
3838 /* wantedy = y + ((wantedy - y) mod YEARSPERREPEAT), sans overflow. */ in rpytime()
3846 while (m != rp->r_month) { in rpytime()
3851 i = rp->r_dayofmonth; in rpytime()
3853 if (rp->r_dycode == DC_DOWLEQ) in rpytime()
3854 --i; in rpytime()
3856 error(_("use of 2/29 in non leap-year")); in rpytime()
3860 --i; in rpytime()
3862 if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) { in rpytime()
3868 while (wday != rp->r_wday) in rpytime()
3869 if (rp->r_dycode == DC_DOWGEQ) { in rpytime()
3875 dayoff = oadd(dayoff, -1); in rpytime()
3876 if (--wday < 0) in rpytime()
3877 wday = DAYSPERWEEK - 1; in rpytime()
3878 --i; in rpytime()
3883 will not work with pre-2004 versions of zic")); in rpytime()
3891 return tadd(t, rp->r_tod); in rpytime()
3906 || *cp == '-' || *cp == '+') in newabbr()
3908 if (noise && cp - string < 3) in newabbr()
3910 if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) in newabbr()
3936 /* On MS-Windows systems, do not worry about drive letters or in mkdirs()
3938 names do not use drive letters and backslashes. If the -d in mkdirs()
3939 option of zic does not name an already-existing directory, in mkdirs()
3940 it can use slashes to separate the already-existing in mkdirs()
3941 ancestor prefix from the to-be-created subdirectories. */ in mkdirs()
3961 Solaris 10 mkdir fails with ENOSYS if the in mkdirs()