diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2019-02-16 15:23:34 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2019-02-16 15:23:34 +0000 |
commit | 2cf49967293dd01cb92500ca0ad4b503a6cf6239 (patch) | |
tree | ace39bfb37b3e54f694da2be67e410da94d2c6a9 | |
parent | 6d8c90a6ec44a4c9a63b843aa07b6ff2de79f305 (diff) |
When specifying the time in the form HHMM or HH:MM, if that time
is already past, the next day is assumed. Handle the case where
we're still in the same hour but the minutes are past.
ok deraadt@ millert@
-rw-r--r-- | usr.bin/at/parsetime.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c index b037370fc09..b9ec685b817 100644 --- a/usr.bin/at/parsetime.c +++ b/usr.bin/at/parsetime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parsetime.c,v 1.26 2015/11/11 17:42:51 millert Exp $ */ +/* $OpenBSD: parsetime.c,v 1.27 2019/02/16 15:23:33 naddy Exp $ */ /* * parsetime.c - parse time for at(1) @@ -432,7 +432,8 @@ tod(struct tm *tm) * a relative offset, it's okay to bump things */ if ((sc_tokid == EOF || sc_tokid == PLUS || sc_tokid == NEXT) && - tm->tm_hour > hour) { + (tm->tm_hour > hour || + (tm->tm_hour == hour && tm->tm_min > minute))) { tm->tm_mday++; tm->tm_wday++; } |