the "date" command from coreutils behaves different as expected: date -d "date -d "1970-01-01 00:00: $timestamp CEST" does not work anymore. for example: date -d "1970-01-01 00:00: 1071197001 UTC" should return: Fri Dec 12 02:43:21 UTC 2003 ...and it does with coreutils 5.0 but with coreutils 5.0.91 it just returns Do Jan 1 00:00:59 UTC 1970 and this output does not change for any timestamp > 59 Does anyone know if this is a bug? Or is that an intentional change of the behaviour? Maybe to achieve more POSIX compliance? Who know more about this?
I can not duplicate your error, it works with coreutils-5.0-r5, coreutils-5.0-r6 and coreutils-5.0.91-r2
Hmm, well I can duplicate it :) ciaranm@snowdrop ciaranm 0 $ qpkg -v -I coreutils sys-apps/coreutils-5.0-r5 * ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 1071197001 UTC" Fri Dec 12 01:43:21 GMT 2003 ciaranm@snowdrop ciaranm 0 $ accept sudo emerge coreutils (yada yada) ciaranm@snowdrop ciaranm 0 $ qpkg -v -I coreutils sys-apps/coreutils-5.0.91-r2 * ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 1071197001 UTC" Thu Jan 1 01:00:59 BST 1970 Playing with gvimdiff doesn't show anything obviously changed between the source files. Looks like anything > 59 for the timestamp is broken. ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 59 UTC" Thu Jan 1 01:00:59 BST 1970 ciaranm@snowdrop ciaranm 0 $ date -d "1970-01-01 00:00: 60 UTC" Thu Jan 1 01:00:59 BST 1970 If no-one's figured it out by the time I get my hands on a monitor that can do > 1024x768 (silly laptop, how am I supposed to use an editor on that?) I'll start tinkering with the source files some more...
Ok, tracked this down to around like 452 in src/date.c when.tv_sec = get_date (datestr, NULL) this knocks the seconds to a max of 59. get_date is in libs/date.c, which is made from libs/date.y, and requires more looking... Just an update...
$ date -d "1970-01-01 00:00: 1071197001 UTC" Thu Dec 11 21:43:21 EST 2003 $ qpkg -v -I coreutils sys-apps/coreutils-5.0.91-r2 *
This looks to be an intentional change. The way to achieve this same function is to use something like: date -d "1970-01-01 00:00:00 + 1071760000seconds UTC"
does coreutils-5.0.91-r3 (just checked into portage) exhibit this as well?
It does on my system...
Yes, it does here, too. Although Josh Grebe's version of the commandline runs here fine, too (it should do on ANY version before)
it's an intentional change upstream, probably for more POSIX compliance again (sigh).