diff --git a/bin/date/date.c b/bin/date/date.c --- a/bin/date/date.c +++ b/bin/date/date.c @@ -334,7 +334,9 @@ } /* convert broken-down time to GMT clock time */ - if ((ts->tv_sec = mktime(lt)) == -1) + lt->tm_yday = -1; + ts->tv_sec = mktime(lt); + if (lt->tm_yday == -1) errx(1, "nonexistent time"); ts->tv_nsec = 0;