diff --git a/zdump.c b/zdump.c index 16e73ae..760491e 100644 --- a/zdump.c +++ b/zdump.c @@ -660,6 +660,15 @@ yeartot(intmax_t y) return t; } + +static void +printtm(char const *name, struct tm const *tm) +{ + printf(" %s={%d-%.3dT%.2d:%.2d:%.2d dst=%d}", + name, tm->tm_year + 1900, tm->tm_yday, + tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_isdst); +} + /* Search for a discontinuity in timezone TZ with name NAME, in the timestamps ranging from LOT (with broken-down time LOTMP if nonnull) through HIT. LOT and HIT disagree about some aspect of @@ -696,6 +705,20 @@ hunt(timezone_t tz, char *name, time_t lot, struct tm *lotmp, time_t hit, if (t == lot) break; tm_ok = my_localtime_rz(tz, &t, &tm) != NULL; + + printf("TRACING: lotm_ok=%d tm_ok=%d only_ok=%d lot=", + lotm_ok, tm_ok, only_ok); + printf(tformat(), lot); + printf(" t="); + printf(tformat(), t); + if (lotm_ok == tm_ok && !only_ok) { + printtm("tm", &tm); + printtm("lotm", &lotm); + printf(" delta=%jd t-lot=", delta(&tm, &lotm)); + printf(tformat(), t - lot); + } + printf("\n"); + if (lotm_ok == tm_ok && (only_ok || (lotm_ok && tm.tm_isdst == lotm.tm_isdst