PR bin/53986 from Christian Weisgerber

Skip forward to tomorrow to run a command earlier in the current
hour than now (as well as during an earlier hour of the day).
This commit is contained in:
kre 2019-02-16 17:56:57 +00:00
parent 5d72569b2f
commit 63ba0d5a97
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parsetime.c,v 1.19 2009/01/18 01:02:31 lukem Exp $ */
/* $NetBSD: parsetime.c,v 1.20 2019/02/16 17:56:57 kre Exp $ */
/*
* parsetime.c - parse time for at(1)
@ -160,7 +160,7 @@ static bool sc_tokplur; /* scanner - is token plural? */
#if 0
static char rcsid[] = "$OpenBSD: parsetime.c,v 1.4 1997/03/01 23:40:10 millert Exp $";
#else
__RCSID("$NetBSD: parsetime.c,v 1.19 2009/01/18 01:02:31 lukem Exp $");
__RCSID("$NetBSD: parsetime.c,v 1.20 2019/02/16 17:56:57 kre Exp $");
#endif
#endif
@ -405,7 +405,8 @@ tod(struct tm *tm)
* if we've gone past that time - but if we're specifying a time plus
* a relative offset, it's okay to bump things
*/
if ((sc_tokid == TOKEOF || sc_tokid == PLUS) && tm->tm_hour > hour) {
if ((sc_tokid == TOKEOF || sc_tokid == PLUS) && (tm->tm_hour > hour ||
(tm->tm_hour == hour && tm->tm_min > minute))) {
tm->tm_mday++;
tm->tm_wday++;
}