GNU bug report logs - #11115
linux date arithmetic

Previous Next

Package: coreutils;

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 #30 received at control <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Stefan Karamuz <stefan <at> karamuz.pl>, 11115 <at> debbugs.gnu.org
Subject: Re: bug#11115: linux date arithmetic
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







This bug report was last modified 6 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.