GNU bug report logs -
#11115
linux date arithmetic
Previous Next
Reported by: Stefan Karamuz <stefan <at> karamuz.pl>
Date: Wed, 28 Mar 2012 17:59:02 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #28 received at control <at> debbugs.gnu.org (full text, mbox):
tags 11115 notabug
close 11115
stop
(triaging old bugs)
Hello,
On 28/03/12 06:39 AM, Stefan Karamuz wrote:
> Please check the 2 linux commands:
>
> date -d "$(date +%F\ %H:%M:%S)" +%F\ %H:%M:%S
> date -d "$(date +%F\ %H:%M:%S) + 1 minute" +%F\ %H:%M:%S
>
> It's very confusing, because the results of the two commands differ in
> one hour and one minute, except of one minute only.
In version 8.26 (released 2016) date gained the "--debug"
option which can help in understanding such issues.
The "+1" is taken to be "UTC+1" time zone, as shown here:
$ date --debug -d "$(date +%F\ %H:%M:%S)" +%F\ %H:%M:%S
date: parsed date part: (Y-M-D) 2018-10-15
date: parsed time part: 10:35:21
date: input timezone: system default
[...]
$ date --debug -d "$(date +%F\ %H:%M:%S) + 1 minute" +%F\ %H:%M:%S
date: parsed date part: (Y-M-D) 2018-10-15
date: parsed time part: 10:35:27 UTC+01
date: parsed relative part: +1 minutes
date: input timezone: parsed date/time string (+01)
[...]
I'm closing this bug, but discussion can continue by replying to this
thread.
regards,
- assaf
This bug report was last modified 6 years and 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.