Subject: Re: bug#11115: linux date arithmetic

From: Assaf Gordon <[email-masked]>
Date: Mon, 15 Oct 2018 10:40:01 -0600

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