GNU bug report logs - #40958
date command give current time zone regardless of seconds since epoch requested.

Previous Next

Package: coreutils;

Reported by: GNAT <gnat <at> 1.gnat.bgcomp.co.uk>

Date: Wed, 29 Apr 2020 10:26:01 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40958 in the body.
You can then email your comments to 40958 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#40958; Package coreutils. (Wed, 29 Apr 2020 10:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to GNAT <gnat <at> 1.gnat.bgcomp.co.uk>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 29 Apr 2020 10:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: GNAT <gnat <at> 1.gnat.bgcomp.co.uk>
To: bug-coreutils <at> gnu.org
Subject: date command give current time zone regardless of seconds since epoch
 requested.
Date: Wed, 29 Apr 2020 09:40:19 +0100
I am going to hazard a guess and say this is the expected behaviour, but I cannot find anything though goog.

The date command has a number of switches, one of which is -d where you give it the number of seconds since epoch, as in "date -d <at> 1234" or "date --date @1234".

Additionally, you can get it to return as any string you want to, as in "date -d <at> 1234 "+%c %z %Z"

Both return "Thu Jan  1 01:20:34 BST 1970" or "Thu Jan  1 01:20:34 +0100 BST 1970" for the UK.

/etc/localtime is set to /usr/share/zoneinfo/Europe/London.

That's wrong, it should give "Thu Jan  1 00:20:34 1970 +0000 GMT".

After all, in January, the UK is not in daylight saving time at the beginning of January.

It therefore gives you the current daylight saving time status, rather than what it should be at the time requested.

I assume currently, this will give erroneous results for any requests in daylight saving.






Information forwarded to bug-coreutils <at> gnu.org:
bug#40958; Package coreutils. (Wed, 29 Apr 2020 10:43:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: GNAT via GNU coreutils Bug Reports <bug-coreutils <at> gnu.org>
Cc: 40958 <at> debbugs.gnu.org, GNAT <gnat <at> 1.gnat.bgcomp.co.uk>
Subject: Re: bug#40958: date command give current time zone regardless of
 seconds since epoch requested.
Date: Wed, 29 Apr 2020 12:42:10 +0200
From <https://en.wikipedia.org/wiki/British_Summer_Time>:

    A further inquiry during 1966–1967 led the government of Harold
    Wilson to introduce the British Standard Time experiment, with
    Britain remaining on GMT+1 throughout the year. This took place
    between 27 October 1968 and 31 October 1971, when there was a
    reversion to the previous arrangement.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-coreutils <at> gnu.org:
bug#40958; Package coreutils. (Wed, 29 Apr 2020 10:43:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 40958 <at> debbugs.gnu.org and GNAT <gnat <at> 1.gnat.bgcomp.co.uk> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 29 Apr 2020 16:49:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#40958; Package coreutils. (Thu, 30 Apr 2020 05:31:02 GMT) Full text and rfc822 format available.

Message #16 received at 40958 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: GNAT <gnat <at> 1.gnat.bgcomp.co.uk>
Cc: 40958 <at> debbugs.gnu.org
Subject: Re: bug#40958: date command give current time zone regardless of
 seconds since epoch requested.
Date: Wed, 29 Apr 2020 23:30:35 -0600
tag 40958 + notabug
close 40958
thanks

GNAT via GNU coreutils Bug Reports wrote:
> I am going to hazard a guess and say this is the expected behaviour,
> but I cannot find anything though goog.

The FAQ gives the recipe to figure these types of problems out.

  https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

And for the timezone and date in question.

  zdump -v Europe/London | grep 1970
  ...no output...

That would be a little confusing.  So let's look at it with a pager
such as less.  Browse and find the years of interest.

  zdump -v Europe/London | less
  ...
  Europe/London  Sun Feb 18 01:59:59 1968 UT = Sun Feb 18 01:59:59 1968 GMT isdst=0 gmtoff=0
  Europe/London  Sun Feb 18 02:00:00 1968 UT = Sun Feb 18 03:00:00 1968 BST isdst=1 gmtoff=3600
  Europe/London  Sat Oct 26 22:59:59 1968 UT = Sat Oct 26 23:59:59 1968 BST isdst=1 gmtoff=3600
  Europe/London  Sat Oct 26 23:00:00 1968 UT = Sun Oct 27 00:00:00 1968 BST isdst=0 gmtoff=3600
  Europe/London  Sun Oct 31 01:59:59 1971 UT = Sun Oct 31 02:59:59 1971 BST isdst=0 gmtoff=3600
  Europe/London  Sun Oct 31 02:00:00 1971 UT = Sun Oct 31 02:00:00 1971 GMT isdst=0 gmtoff=0
  ...

And therefore it is of course as Andreas Schwab wrote.  "This took
place between 27 October 1968 and 31 October 1971, ..."  An
interesting footnote of history!

The date command uses the Time Zone Database for this information.
The database is typically updated by the operating system software
distribution upon which GNU date is run.  The The source of the
database is available here.

  https://www.iana.org/time-zones

GNU date is operating upon the data from that database.  That database
is updated often as it is a global compilation of every act of
governance and must be updated as the timezone rules are updated.  In
the Debian and derivative software distributions I know this is
packaged in the 'tzdata' package.

> The date command has a number of switches, one of which is -d where you give it the number of seconds since epoch, as in "date -d <at> 1234" or "date --date @1234".
> 
> Additionally, you can get it to return as any string you want to, as in "date -d <at> 1234 "+%c %z %Z"
> 
> Both return "Thu Jan  1 01:20:34 BST 1970" or "Thu Jan  1 01:20:34 +0100 BST 1970" for the UK.
> 
> /etc/localtime is set to /usr/share/zoneinfo/Europe/London.
> 
> That's wrong, it should give "Thu Jan  1 00:20:34 1970 +0000 GMT".
> 
> After all, in January, the UK is not in daylight saving time at the beginning of January.

And yet there it was!  By an Act of Governance daylight saving time
was in effect at that time!  No one is safe when the government is in
session. :-)

> It therefore gives you the current daylight saving time status,
> rather than what it should be at the time requested.
> 
> I assume currently, this will give erroneous results for any
> requests in daylight saving.

Because date appears to be operating correctly I am closing this bug
ticket.  But please we welcome that any discussion may continue in the
bug ticket.

Bob




Added tag(s) notabug. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Thu, 30 Apr 2020 05:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 May 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 24 days ago.

Previous Next


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