Lines Matching +full:pre +full:- +full:packaged
5 ** 2009-05-17 by Arthur David Olson.
34 # define ZDUMP_LO_YEAR (-500)
44 + SECSPERLYEAR * (intmax_t) (100 - 3))
65 enum { atime_shift = CHAR_BIT * sizeof(time_t) - 2 };
67 ((time_t) -1 < 0
68 ? (- ((time_t) ~ (time_t) 0 < 0)
69 - (((time_t) 1 << atime_shift) - 1 + ((time_t) 1 << atime_shift)))
72 ((time_t) -1 < 0
73 ? (((time_t) 1 << atime_shift) - 1 + ((time_t) 1 << atime_shift))
74 : -1);
135 if (a <= INDEX_MAX && b <= INDEX_MAX - a) in sumsize()
240 return &optarg; /* Any valid non-null char ** will do. */ in tzalloc()
305 the "Zone GMT 0 - GMT" line in the "etcetera" file. If "GMT" in gmtzinit()
326 /* Convert *TP to UT, storing the broken-down time into *TMP.
353 fprintf(stderr, " ->"); in my_localtime_rz()
354 fprintf(stderr, " year=%d", tmp->tm_year); in my_localtime_rz()
355 fprintf(stderr, " mon=%d", tmp->tm_mon); in my_localtime_rz()
356 fprintf(stderr, " mday=%d", tmp->tm_mday); in my_localtime_rz()
357 fprintf(stderr, " hour=%d", tmp->tm_hour); in my_localtime_rz()
358 fprintf(stderr, " min=%d", tmp->tm_min); in my_localtime_rz()
359 fprintf(stderr, " sec=%d", tmp->tm_sec); in my_localtime_rz()
360 fprintf(stderr, " isdst=%d", tmp->tm_isdst); in my_localtime_rz()
361 fprintf(stderr, " -> "); in my_localtime_rz()
380 while (is_alpha(*cp) || is_digit(*cp) || *cp == '-' || *cp == '+') in abbrok()
383 wp = _("has characters other than ASCII alphanumerics, '-' or '+'"); in abbrok()
384 else if (cp - abbrp < 3) in abbrok()
386 else if (cp - abbrp > 6) in abbrok()
440 " -c [L,]U Start at year L (default -500), end before year U (default 2500)\n" in usage()
441 " -t [L,]U Start at time L, end before time U (in seconds since 1970)\n" in usage()
442 " -i List transitions briefly (format is experimental)\n" \ in usage()
443 " -v List transitions verbosely\n" in usage()
444 " -V List transitions a bit less verbosely\n" in usage()
445 " --help Output this help\n" in usage()
446 " --version Output version info\n" in usage()
484 if (strcmp(argv[i], "--version") == 0) { in main()
487 } else if (strcmp(argv[i], "--help") == 0) { in main()
499 case -1: in main()
500 if (! (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) in main()
525 fprintf(stderr, _("%s: wild -c argument %s\n"), in main()
558 _("%s: wild -t argument %s\n"), in main()
578 longest = min(arglenmax, INT_MAX - 2); in main()
581 /* Treat "-" as standard input on platforms with /dev/stdin. in main()
582 It's not worth the bother of supporting "-" on other in main()
584 timezone_t tz = tzalloc(strcmp(argv[i], "-") == 0 in main()
613 t = cutlotime - 1; in main()
619 showtrans("-\t-\t%Q", &tm, t, ab, argv[i]); in main()
623 while (t < cuthitime - 1) { in main()
624 time_t newt = ((t < absolute_max_time - SECSPERDAY / 2 in main()
625 && t + SECSPERDAY / 2 < cuthitime - 1) in main()
627 : cuthitime - 1); in main()
631 || (ab && (delta(&newtm, &tm) != newt - t in main()
638 showtrans("%Y-%m-%d\t%L\t%Q", newtmp, newt, in main()
641 show(tz, argv[i], newt - 1, true); in main()
680 if (SECSPER400YEARS_FITS && 400 <= y - myy) { in yeartot()
681 intmax_t diff400 = (y - myy) / 400; in yeartot()
691 if (t > absolute_max_time - seconds) in yeartot()
697 intmax_t diff400 = (myy - y) / 400; in yeartot()
703 seconds = isleap(myy - 1) ? SECSPERLYEAR : SECSPERNYEAR; in yeartot()
706 myy -= years; in yeartot()
709 t -= seconds; in yeartot()
729 /* Convert LOT into a broken-down time here, even though our in hunt()
741 time_t t = (rem_sum == 2) - (rem_sum < 0) + lot / 2 + hit / 2; in hunt()
748 && delta(&tm, &lotm) == t - lot in hunt()
765 intmax_t oldy = oldp->tm_year; in delta_nonneg()
766 int cycles = (newp->tm_year - oldy) / YEARSPERREPEAT; in delta_nonneg()
768 int tmy = oldp->tm_year + cycles * YEARSPERREPEAT; in delta_nonneg()
769 for ( ; tmy < newp->tm_year; ++tmy) in delta_nonneg()
771 result += newp->tm_yday - oldp->tm_yday; in delta_nonneg()
773 result += newp->tm_hour - oldp->tm_hour; in delta_nonneg()
775 result += newp->tm_min - oldp->tm_min; in delta_nonneg()
777 result += newp->tm_sec - oldp->tm_sec; in delta_nonneg()
784 return (newp->tm_year < oldp->tm_year in delta()
785 ? -delta_nonneg(oldp, newp) in delta()
790 /* Return A->tm_yday, adjusted to compare it fairly to B->tm_yday.
795 int yday = a->tm_yday; in adjusted_yday()
796 if (b->tm_year < a->tm_year) in adjusted_yday()
797 yday += 365 + isleap_sum(b->tm_year, TM_YEAR_BASE); in adjusted_yday()
802 /* If A is the broken-down local time and B the broken-down UT for
814 return a->TM_GMTOFF; in gmtoff()
824 int days = ayday - byday; in gmtoff()
825 long hours = a->tm_hour - b->tm_hour + 24 * days; in gmtoff()
826 long minutes = a->tm_min - b->tm_min + 60 * hours; in gmtoff()
827 long seconds = a->tm_sec - b->tm_sec + 60 * minutes; in gmtoff()
840 printf("%-*s ", (int)longest, zone); in show()
862 printf(" isdst=%d", tmp->tm_isdst); in show()
875 the range from LO (with broken-down time LOTMP if that is nonnull)
884 hi = (SECSPERDAY < hi - boundary in showextrema()
887 if (SECSPERDAY < boundary - lo) { in showextrema()
888 lo = boundary - SECSPERDAY; in showextrema()
894 localtm[old].tm_sec = -1; in showextrema()
896 gmtm[old].tm_sec = -1; in showextrema()
905 localtm[new].tm_sec = -1; in showextrema()
907 gmtm[new].tm_sec = -1; in showextrema()
910 show(tz, zone, t - 1, true); in showextrema()
917 /* On pre-C99 platforms, a snprintf substitute good enough for us. */
942 slen = arglen < size ? arglen : size - 1; in my_snprintf()
946 n = arglen <= INT_MAX ? arglen : -1; in my_snprintf()
963 int ss = tm->tm_sec, mm = tm->tm_min, hh = tm->tm_hour; in format_local_time()
973 +HHMMSS, or -HHMMSS for timestamps west of Greenwich; use the
974 format -00 for unknown UT offsets. If the hour needs more than
979 Return the length of the resulting string, or -1 if the result is
989 && (*abbr(tm) == '-' || strcmp(abbr(tm), "zzz") == 0))) in format_utc_offset()
990 ? '-' : '+'); in format_utc_offset()
996 return -1; in format_utc_offset()
997 off = -off; in format_utc_offset()
1020 *b++ = '"', s--; in format_quoted_string()
1026 default: *b++ = c, s--; continue; in format_quoted_string()
1027 case '\0': *b++ = '"', s--; return size - s; in format_quoted_string()
1036 *b++ = '\\', *b++ = c, s -= 2; in format_quoted_string()
1041 TM is the broken-down time, T the seconds count, AB the time zone
1069 ptrdiff_t f_prefix_len = p - f; in istrftime()
1082 formatted_len--; in istrftime()
1083 b += formatted_len, s -= formatted_len; in istrftime()
1100 b += offlen, s -= offlen; in istrftime()
1106 *b++ = '\t', s--; in istrftime()
1114 b += len, s -= len; in istrftime()
1117 = (tm->tm_isdst in istrftime()
1118 ? snprintf(b, s, &"\t\t%d"[show_abbr], tm->tm_isdst) in istrftime()
1125 b += formatted_len, s -= formatted_len; in istrftime()
1159 return tmp->TM_ZONE; in abbr()
1162 if (0 <= tmp->tm_isdst && tzname[0 < tmp->tm_isdst]) in abbr()
1163 return tzname[0 < tmp->tm_isdst]; in abbr()
1171 ** it works on all known real-world systems as of 2022-01-25.
1178 /* C11-style _Generic is more likely to return the correct in tformat()
1194 if (0 > (time_t) -1) { /* signed */ in tformat()
1229 ** The packaged localtime_rz and gmtime_r never put out-of-range in dumptime()
1234 ((0 <= timeptr->tm_wday in dumptime()
1235 && timeptr->tm_wday < (int)(sizeof wday_name / sizeof wday_name[0])) in dumptime()
1236 ? wday_name[timeptr->tm_wday] : "???"), in dumptime()
1237 ((0 <= timeptr->tm_mon in dumptime()
1238 && timeptr->tm_mon < (int)(sizeof mon_name / sizeof mon_name[0])) in dumptime()
1239 ? mon_name[timeptr->tm_mon] : "???"), in dumptime()
1240 timeptr->tm_mday, timeptr->tm_hour, in dumptime()
1241 timeptr->tm_min, timeptr->tm_sec); in dumptime()
1242 trail = timeptr->tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR; in dumptime()
1243 lead = timeptr->tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR + in dumptime()
1248 --lead; in dumptime()
1250 trail -= DIVISOR; in dumptime()
1255 else printf("%d%d", lead, ((trail < 0) ? -trail : trail)); in dumptime()