aboutsummaryrefslogtreecommitdiff
path: root/bin/date
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2024-04-28 17:12:58 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-04-28 17:12:58 +0000
commitdafb424b8d44c7fdc9cfe876a79aad05c438def0 (patch)
tree9500f7bc3f5e3da4967d81dcde92829a182b79d1 /bin/date
parentb30a7e5418be5c5d27ac967f5ce99461ab79c37c (diff)
downloadsrc-dafb424b8d44c7fdc9cfe876a79aad05c438def0.tar.gz
src-dafb424b8d44c7fdc9cfe876a79aad05c438def0.zip
Diffstat (limited to 'bin/date')
-rw-r--r--bin/date/date.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/date/date.c b/bin/date/date.c
index 718c94601dd6..3ce9ee3235fb 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -334,7 +334,9 @@ setthetime(const char *fmt, const char *p, int jflag, struct timespec *ts)
}
/* 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;