LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   "at" command with day of week (https://www.linuxquestions.org/questions/linux-software-2/at-command-with-day-of-week-778993/)

at-user 12-30-2009 09:51 PM

"at" command with day of week
 
Today, Wednesday 30 December 2009, at 8:00 AM, I entered the
following 'at' command:
at 9:30 AM Friday

I continued with my commands and ctl-D, and was surprised
to receive the following output:
job 96 at Sat Jan 1 09:30:00 2011

A quick check with atq confirmed:
96 Sat Jan 1 21:30:00 2011 a atusr

I really was expecting to see Fri, Jan 1, 2010.
Can anyone explain this?

(BTW, I'm running Ubuntu Karmic, pretty much out-of-the-box.)

bigrigdriver 12-30-2009 11:28 PM

What do you get when you run "date"? Does it tell you your system time is set for 2009 or 2010?

at-user 12-31-2009 08:57 AM

"at" -- system date/time OK
 
Yes, "date" shows correct date and time (thanks, ntpd!). Also,
to keep the post short I didn't mention some variations of the
time specification that I also tried. It's now 6:40 AM, Thu
31 Dec. Here are some other "at" commands and results:

1. "at 8:00 AM today" gives job at "Thu Dec 31 08:00:00 2009"
2. "at 8:00 AM tomorrow" gives job at "Sat Jan 1 08:00:00 2011"
3. "at 8:00 AM + 24 hours" gives job at "Fri Jan 1 08:00:00 2010"

Strange, no?

jlinkels 12-31-2009 12:08 PM

That looks like a bug in the 'at' command. I have tried it in version 3.1.9 on Debian and it reproduces.

jlinkels

at-user 12-31-2009 12:25 PM

"at" - it _is_ a bug
 
I did finally find the bug report page for "at", and this turns
out to be a very old bug - reported in 2006 and still active.

Given the complexity of the POSIX time specs, it isn't surprising
that there are quite a few parsing bugs in the "at" program; what
does surprise me is that they aren't using (or don't have) a well-
tested GNU library to do the parsing.

jlinkels 12-31-2009 02:46 PM

The date command calculates correctly. Indeed one wonders why these commands use different libraries.

jlinkels


All times are GMT -5. The time now is 08:17 AM.