bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26101: Counterproductive calculation order in date


From: Ulf Zibis
Subject: bug#26101: Counterproductive calculation order in date
Date: Wed, 15 Mar 2017 01:17:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

Hi,

with
    $ date -r test
I get:
    Di 10. Jan 22:39:14 CET 2017
but with
    $ date -d "$(($(date -r test +%s)-$(date +%s))) seconds -2 months"
I get:
   Sa 12. Nov 22:39:14 CET 2016

I think the better result would be according to a calculation order from left to right:
   Sa 10. Nov 22:39:14 CET 2016

Otherwise it seems impossible to correctly change the time stamp of a file relative to its current value.
Example:
$ touch -t $(date -d "$(($(date -r test +%s)-$(date +%s))) seconds -2 months" +%Y%m%d%H%M.%S) test
Additionally the command is not correctly reversible with:
$ touch -t $(date -d "$(($(date -r test +%s)-$(date +%s))) seconds +2 months" +%Y%m%d%H%M.%S) test

Regards
Ulf

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]