Todd C. Miller:

> The manual is correct.  Below is one way to fix this, though the
> logic probably belongs in tod() itself.

I think tod() already has the required logic, but it doesn't handle
the case where the time is only past by minutes.

Index: parsetime.c
===================================================================
RCS file: /cvs/src/usr.bin/at/parsetime.c,v
retrieving revision 1.26
diff -u -p -r1.26 parsetime.c
--- parsetime.c 11 Nov 2015 17:42:51 -0000      1.26
+++ parsetime.c 16 Feb 2019 00:44:27 -0000
@@ -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++;
        }
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to