Bug 235781

Summary: [patch] at(1) HH:MM fails to assume next day
Product: Base System Reporter: Christian Weisgerber <naddy>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People Keywords: patch
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Description Flags
Fix at(1) failure to assume next day none

Description Christian Weisgerber freebsd_committer 2019-02-16 16:03:43 UTC
Created attachment 202068 [details]
Fix at(1) failure to assume next day

The at(1) man page says:

     The at utility allows some moderately complex time specifications.  It
     accepts times of the form HHMM or HH:MM to run a job at a specific time
     of day.  (If that time is already past, the next day is assumed.)

Due to an ancient bug, this only works if the hour is past.  It fails if we are still within the same hour but the minutes are past:

  $ date
  Sat Feb 16 16:56:28 CET 2019
  $ echo dummy | at 15:00
  Job 42 will be executed using /bin/sh
  $ echo dummy | at 16:00
  at: trying to travel back in time

Simple fix attached.  This is applicable to all versions of FreeBSD.