Lines Matching +full:y +full:- +full:rp
128 static zic_t rpytime(const struct rule *rp, int wantedy);
129 static void rulesub(struct rule *rp,
298 { "last-Sunday", TM_SUNDAY },
299 { "last-Monday", TM_MONDAY },
300 { "last-Tuesday", TM_TUESDAY },
301 { "last-Wednesday", TM_WEDNESDAY },
302 { "last-Thursday", TM_THURSDAY },
303 { "last-Friday", TM_FRIDAY },
304 { "last-Saturday", TM_SATURDAY },
394 eats(name, num, (char *)NULL, -1);
403 * zic ... 2>&1 | error -t "*" -v
425 --errors;
433 "[ --version ] [ -s ] [ -v ] [ -l localtime ] " in usage()
434 "\n\t[ -p posixrules ] [ -d directory ] [ -L leapseconds ] " in usage()
435 "[ -y yearistype ] [ filename ... ]\n"), progname, progname); in usage()
438 "[ --version ] [ -s ] [ -v ] [ -l localtime ]" in usage()
439 "\n\t[ -p posixrules ] [ -d directory ] [ -y yearistype ] " in usage()
470 if (strcmp(argv[i], "--version") == 0) {
488 "%s: More than one -d option specified\n"),
498 "%s: More than one -l option specified\n"),
508 "%s: More than one -p option specified\n"),
513 case 'y':
518 "%s: More than one -y option specified\n"),
529 "%s: More than one -L option specified\n"),
542 if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
565 * Find the next non-continuation zone entry.
569 outzone(&zones[i], j - i);
667 * The tz file format currently allows at most 32-bit quantities.
668 * This restriction should be removed before signed 32-bit values
684 min_time = -1; in setboundaries()
685 for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i) in setboundaries()
687 max_time = -(min_time + 1); in setboundaries()
692 max_time = 2 - sflag; in setboundaries()
693 for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i) in setboundaries()
695 --max_time; in setboundaries()
701 min_year = TM_YEAR_BASE + gmtime(&t)->tm_year; in setboundaries()
703 max_year = TM_YEAR_BASE + gmtime(&t)->tm_year; in setboundaries()
736 return (strcmp(((const struct rule *) cp1)->r_name,
737 ((const struct rule *) cp2)->r_name));
744 register struct rule *rp; in associate() local
751 for (i = 0; i < nrules - 1; ++i) { in associate()
774 i = j - 1; in associate()
779 zp->z_rules = NULL; in associate()
780 zp->z_nrules = 0; in associate()
783 rp = &rules[base]; in associate()
785 if (strcmp(rp->r_name, rules[out].r_name) != 0) in associate()
789 if (strcmp(zp->z_rule, rp->r_name) != 0) in associate()
791 zp->z_rules = rp; in associate()
792 zp->z_nrules = out - base; in associate()
797 if (zp->z_nrules == 0) { in associate()
801 eat(zp->z_filename, zp->z_linenum); in associate()
802 zp->z_stdoff = gethms(zp->z_rule, in associate()
808 if (strchr(zp->z_format, '%') != 0) in associate()
829 if (strcmp(name, "-") == 0) {
855 if (strcmp(fields[nfields], "-") == 0)
867 else switch ((int)(lp->l_value)) {
892 progname, lp->l_value);
915 * h -h hh:mm -hh:mm hh:mm:ss -hh:mm:ss
934 else if (*string == '-') {
935 sign = -1;
959 gettext("24:00 not handled by pre-1998 versions of zic"));
963 "pre-2007 versions of zic"));
1012 gettext("\"Zone %s\" line and -l option are mutually exclusive"),
1020 gettext("\"Zone %s\" line and -p option are mutually exclusive"),
1116 zones[nzones - 1].z_untiltime > min_time &&
1117 zones[nzones - 1].z_untiltime < max_time &&
1118 zones[nzones - 1].z_untiltime >= z.z_untiltime) {
1166 --j;
1167 i = -len_years[isleap(j)];
1175 month = lp->l_value;
1188 dayoff = oadd(dayoff, eitol(day - 1));
1208 if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */
1211 } else if (strcmp(cp, "--") == 0) {
1229 leapadd(tadd(t, tod), positive, lp->l_value, count);
1263 rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep) in rulesub() argument
1264 register struct rule * const rp; in rulesub()
1281 rp->r_month = lp->l_value;
1282 rp->r_todisstd = FALSE;
1283 rp->r_todisgmt = FALSE;
1286 ep = dp + strlen(dp) - 1;
1289 rp->r_todisstd = TRUE;
1290 rp->r_todisgmt = FALSE;
1294 rp->r_todisstd = FALSE;
1295 rp->r_todisgmt = FALSE;
1301 rp->r_todisstd = TRUE;
1302 rp->r_todisgmt = TRUE;
1307 rp->r_tod = gethms(dp, gettext("invalid time of day"), FALSE);
1315 switch ((int)lp->l_value) {
1317 rp->r_loyear = INT_MIN;
1320 rp->r_loyear = INT_MAX;
1325 progname, lp->l_value);
1328 } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
1332 if (rp->r_loyear < min_year_representable)
1335 else if (rp->r_loyear > max_year_representable)
1341 switch ((int)lp->l_value) {
1343 rp->r_hiyear = INT_MIN;
1346 rp->r_hiyear = INT_MAX;
1349 rp->r_hiyear = rp->r_loyear;
1354 progname, lp->l_value);
1357 } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
1361 if (rp->r_loyear < min_year_representable)
1364 else if (rp->r_loyear > max_year_representable)
1368 if (rp->r_loyear > rp->r_hiyear) {
1373 rp->r_yrtype = NULL;
1375 if (rp->r_loyear == rp->r_hiyear) {
1379 rp->r_yrtype = ecpyalloc(typep);
1381 if (rp->r_loyear < min_year && rp->r_loyear > 0)
1382 min_year = rp->r_loyear;
1387 * last-Sunday
1393 rp->r_dycode = DC_DOWLEQ;
1394 rp->r_wday = lp->l_value;
1395 rp->r_dayofmonth = len_months[1][rp->r_month];
1398 rp->r_dycode = DC_DOWLEQ;
1400 rp->r_dycode = DC_DOWGEQ;
1403 rp->r_dycode = DC_DOM;
1405 if (rp->r_dycode != DC_DOM) {
1417 rp->r_wday = lp->l_value;
1419 if (sscanf(ep, scheck(ep, "%d"), &rp->r_dayofmonth) != 1 ||
1420 rp->r_dayofmonth <= 0 ||
1421 (rp->r_dayofmonth > len_months[1][rp->r_month])) {
1438 for (i = 0, shift = 24; i < 4; ++i, shift -= 8)
1458 if (((struct attype *)avp)->at < ((struct attype *)bvp)->at)
1459 return (-1);
1460 else if (((struct attype *)avp)->at > ((struct attype *)bvp)->at)
1498 gmtoffs[attypes[toi - 1].type]) <=
1499 (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
1500 : attypes[toi - 2].type]))) {
1501 attypes[toi - 1].type =
1506 attypes[toi - 1].type != attypes[fromi].type)
1562 while (--j >= 0)
1593 j = types[j - 1];
1595 puttzcode((long)tadd(trans[i], -gmtoffs[j]), fp);
1636 register struct rule *rp; local
1669 usestart = i > 0 && (zp - 1)->z_untiltime > min_time;
1670 useuntil = i < (zonecount - 1);
1671 if (useuntil && zp->z_untiltime <= min_time)
1673 gmtoff = zp->z_gmtoff;
1674 eat(zp->z_filename, zp->z_linenum);
1676 startoff = zp->z_gmtoff;
1677 if (zp->z_nrules == 0) {
1678 stdoff = zp->z_stdoff;
1679 doabbr(startbuf, zp->z_format,
1681 type = addtype(oadd(zp->z_gmtoff, stdoff),
1691 if (useuntil && year > zp->z_untilrule.r_hiyear)
1695 * For those to do, calculate rpytime(rp, year);
1697 for (j = 0; j < zp->z_nrules; ++j) {
1698 rp = &zp->z_rules[j];
1699 eats(zp->z_filename, zp->z_linenum,
1700 rp->r_filename, rp->r_linenum);
1701 rp->r_todo = year >= rp->r_loyear &&
1702 year <= rp->r_hiyear &&
1703 yearistype(year, rp->r_yrtype);
1704 if (rp->r_todo)
1705 rp->r_temp = rpytime(rp, year);
1719 untiltime = zp->z_untiltime;
1720 if (!zp->z_untilrule.r_todisgmt)
1722 -gmtoff);
1723 if (!zp->z_untilrule.r_todisstd)
1725 -stdoff);
1731 k = -1;
1732 for (j = 0; j < zp->z_nrules; ++j) {
1733 rp = &zp->z_rules[j];
1734 if (!rp->r_todo)
1736 eats(zp->z_filename, zp->z_linenum,
1737 rp->r_filename, rp->r_linenum);
1738 offset = rp->r_todisgmt ? 0 : gmtoff;
1739 if (!rp->r_todisstd)
1741 jtime = rp->r_temp;
1745 jtime = tadd(jtime, -offset);
1753 rp = &zp->z_rules[k];
1754 rp->r_todo = FALSE;
1757 stdoff = rp->r_stdoff;
1762 startoff = oadd(zp->z_gmtoff,
1764 doabbr(startbuf, zp->z_format,
1765 rp->r_abbrvar,
1766 rp->r_stdoff != 0);
1770 startoff == oadd(zp->z_gmtoff,
1772 doabbr(startbuf, zp->z_format,
1773 rp->r_abbrvar,
1774 rp->r_stdoff != 0);
1777 eats(zp->z_filename, zp->z_linenum,
1778 rp->r_filename, rp->r_linenum);
1779 doabbr(buf, zp->z_format, rp->r_abbrvar,
1780 rp->r_stdoff != 0);
1781 offset = oadd(zp->z_gmtoff, rp->r_stdoff);
1782 type = addtype(offset, buf, rp->r_stdoff != 0,
1783 rp->r_todisstd, rp->r_todisgmt);
1789 zp->z_format != NULL &&
1790 strchr(zp->z_format, '%') == NULL &&
1791 strchr(zp->z_format, '/') == NULL)
1792 (void) strcpy(startbuf, zp->z_format);
1793 eat(zp->z_filename, zp->z_linenum);
1799 startoff != zp->z_gmtoff,
1807 startttisstd = zp->z_untilrule.r_todisstd;
1808 startttisgmt = zp->z_untilrule.r_todisgmt;
1809 starttime = zp->z_untiltime;
1811 starttime = tadd(starttime, -stdoff);
1813 starttime = tadd(starttime, -gmtoff);
1816 writezone(zpfirst->z_name);
1859 "internal error - addtype called with bad isdst"));
1864 "internal error - addtype called with bad ttisstd"));
1869 "internal error - addtype called with bad ttisgmt"));
1891 if (!(-1L - 2147483647L <= gmtoff && gmtoff <= 2147483647L)) {
1933 for (j = leapcnt; j > i; --j) {
1934 trans[j] = trans[j - 1];
1935 corr[j] = corr[j - 1];
1936 roll[j] = roll[j - 1];
1939 corr[i] = positive ? 1L : eitol(-count);
1942 } while (positive && --count != 0);
2011 ciequal(ap, bp) /* case-insensitive equality */ in ciequal()
2050 for (lp = table; lp->l_word != NULL; ++lp)
2051 if (ciequal(word, lp->l_word))
2057 for (lp = table; lp->l_word != NULL; ++lp)
2058 if (itsabbr(word, lp->l_word)) {
2141 * Given a rule, and a year, compute the date - in seconds since January 1,
2142 * 1970, 00:00 LOCAL time - in that year that the rule refers to.
2146 rpytime(rp, wantedy) in rpytime() argument
2147 register const struct rule * const rp; in rpytime()
2150 register int y, m, i; local
2160 y = EPOCH_YEAR;
2161 while (wantedy != y) {
2162 if (wantedy > y) {
2163 i = len_years[isleap(y)];
2164 ++y;
2166 --y;
2167 i = -len_years[isleap(y)];
2171 while (m != rp->r_month) {
2172 i = len_months[isleap(y)][m];
2176 i = rp->r_dayofmonth;
2177 if (m == TM_FEBRUARY && i == 29 && !isleap(y)) {
2178 if (rp->r_dycode == DC_DOWLEQ)
2179 --i;
2181 error(gettext("use of 2/29 in non leap-year"));
2185 --i;
2187 if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {
2198 wday -= ((-dayoff) % LDAYSPERWEEK);
2202 while (wday != eitol(rp->r_wday))
2203 if (rp->r_dycode == DC_DOWGEQ) {
2209 dayoff = oadd(dayoff, (long)-1);
2210 if (--wday < 0)
2211 wday = LDAYSPERWEEK - 1;
2212 --i;
2214 if (i < 0 || i >= len_months[isleap(y)][m]) {
2217 "month--will not work with pre-2004 "
2228 return (tadd(t, rp->r_tod));
2243 *cp == '-' || *cp == '+') { in newabbr()
2246 if (noise && cp - string < 3) in newabbr()
2249 if (wp == NULL && cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) in newabbr()
2252 if (wp == NULL && (*cp == '+' || *cp == '-')) { in newabbr()
2307 return (-1);