Subject: bug#6897: closed (Re: bug#6897: date -d '1991-04-14 +1 day' fails)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 23 Aug 2010 08:48:02 +0000

Your bug report

#6897: date -d '1991-04-14 +1 day' fails

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
6897: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6897
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#6897: date -d '1991-04-14 +1 day' fails
From: Bob Proulx <[email-masked]>
To: 李嘉鹏 <[email-masked]>
Cc: [email-masked]
Date: Mon, 23 Aug 2010 02:48:43 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

Bob Proulx wrote:
> 李嘉鹏 wrote:
> > I used some script(At the end of the letter) to get a series of
> > date. but the script always fails at the date 1991-04-14. so I
> > tested the single command
> >     date -d '1991-04-14 +1 day'
> > It would also fail with a error message
> >     date: invalid date `1991-04-14 +1 day'
> > displayed.
> 
> Thank you for the bug report.  However I am unable to reproduce it.
> Therefore I conclude that the problem must be related to your
> timezone.  Because you are taking dates a midnight I am guessing that
> there is very likely a daylight savings time issue there.  (Was
> Daylight Savings Time active then?)  Instead, try looking at dates at
> noon.
> 
>   date -d '1991-04-14 12:00 +1 day'

Using Asia/Chongqing timezone shows that DST was active at that time.

  $ zdump -v Asia/Chongqing | grep 1991
  Asia/Chongqing  Sat Apr 13 15:59:59 1991 UTC = Sat Apr 13 23:59:59 1991 CST isdst=0 gmtoff=28800
  Asia/Chongqing  Sat Apr 13 16:00:00 1991 UTC = Sun Apr 14 01:00:00 1991 CDT isdst=1 gmtoff=32400
  Asia/Chongqing  Sat Sep 14 14:59:59 1991 UTC = Sat Sep 14 23:59:59 1991 CDT isdst=1 gmtoff=32400
  Asia/Chongqing  Sat Sep 14 15:00:00 1991 UTC = Sat Sep 14 23:00:00 1991 CST isdst=0 gmtoff=28800

There was no 1991-04-14 00:00:00 since the time progressed to Apr 14
01:00:00 with the next clock tick.  Because 1991-04-14 00:00:00 does
not exist 'date' returns an invalid date error for it.

Using the time at noon would avoid these problems.  Also using time in
UTC avoids all daylight savings time issues.

Bob

Subject: date -d '1991-04-14 +1 day' fails
From: 李嘉鹏 <[email-masked]>
To: [email-masked]
Date: Sun, 22 Aug 2010 11:04:44 +0800 (CST)

Hi,
I used some script(At the end of the letter) to get a series of date. but the script always fails at the date 1991-04-14. so I tested the single command
    date -d '1991-04-14 +1 day'
It would also fail with a error message
    date: invalid date `1991-04-14 +1 day'
displayed.
 
Here's some infomation about my platform:
jpli@databank:~> env
MKLROOT=/home/jpli/software/intel/Compiler/11.1/072/mkl
LESSKEY=/etc/lesskey.bin
NNTPSERVER=news
INFODIR=/usr/local/info:/usr/share/info:/usr/info
MANPATH=/home/jpli/software/ncview-1.93g/man:/home/jpli/software/intel/Compiler/11.1/072/man/en_US:/home/jpli/software/intel/Compiler/11.1/072/mkl/man/en_US:/home/jpli/software/intel/Compiler/11.1/072/man/en_US:/home/jpli/software/intel/Compiler/11.1/072/mkl/man/en_US:/software/pgi/linux86-64/7.1/mpi/mpich/man:/software/pgi/linux86-64/7.1/man:/usr/lib64/mpi/gcc/openmpi/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man
HOSTNAME=databank
XKEYSYMDB=/usr/share/X11/XKeysymDB
INTEL_LICENSE_FILE=/home/jpli/software/intel/Compiler/11.1/072/licenses:/opt/intel/licenses:/home/jpli/intel/licenses:/home/jpli/software/intel/Compiler/11.1/072/licenses:/opt/intel/licenses:/home/jpli/intel/licenses
NCARG_INCLUDE=/software/ncarg-pgi/include
HOST=databank
TERM=xterm
SHELL=/bin/bash
PROFILEREAD=true
HISTSIZE=1000
SSH_CLIENT=172.16.102.36 54010 22
LIBRARY_PATH=/home/jpli/software/intel/Compiler/11.1/072/lib/intel64:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t:/home/jpli/software/intel/Compiler/11.1/072/lib/intel64:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t
FPATH=/home/jpli/software/intel/Compiler/11.1/072/mkl/include:/home/jpli/software/intel/Compiler/11.1/072/mkl/include
MORE=-sl
QTDIR=/usr/lib/qt3
SSH_TTY=/dev/pts/2
JRE_HOME=/usr/lib64/jvm/jre
USER=jpli
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:
LD_LIBRARY_PATH=/home/jpli/software/intel/impi/3.2.0.011/lib64:/home/jpli/software/intel/Compiler/11.1/072/lib/intel64:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t:/home/jpli/software/intel/Compiler/11.1/072/lib/intel64:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t:/usr/lib64/mpi/gcc/openmpi/lib64
XNLSPATH=/usr/share/X11/nls
NCARG_BIN=/software/ncarg-pgi/bin
ENV=/etc/bash.bashrc
CPATH=/home/jpli/software/intel/Compiler/11.1/072/mkl/include:/home/jpli/software/intel/Compiler/11.1/072/mkl/include
HOSTTYPE=x86_64
GASCRP=/software/grads/lib
FROM_HEADER=
PAGER=less
CSHEDIT=emacs
XDG_CONFIG_DIRS=/etc/xdg
NLSPATH=/home/jpli/software/intel/Compiler/11.1/072/lib/intel64/locale/%l_%t/%N:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t/locale/%l_%t/%N:/home/jpli/software/intel/Compiler/11.1/072/idb/intel64/locale/%l_%t/%N:/home/jpli/software/intel/Compiler/11.1/072/lib/intel64/locale/%l_%t/%N:/home/jpli/software/intel/Compiler/11.1/072/mkl/lib/em64t/locale/%l_%t/%N:/home/jpli/software/intel/Compiler/11.1/072/idb/intel64/locale/%l_%t/%N
PGI=/software/pgi
MINICOM=-c on
MAIL=/var/mail/jpli
PATH=/home/jpli/bin:/software/matlab/R2009b/bin/:/software/R/bin:/software/grads/bin:/home/jpli/software/netcdf-intel/bin:/software/ncarg-pgi/bin:/home/jpli/software/intel/impi/3.2.0.011/bin64:/home/jpli/software/intel/Compiler/11.1/072/bin/intel64:/home/jpli/software/intel/Compiler/11.1/072/bin/intel64:/software/pgi/linux86-64/7.1-6/bin:/software/pgi/linux86-64/7.1/mpi/mpich/bin:/usr/lib64/mpi/gcc/openmpi/bin:/home/jpli/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin:/home/jpli/software/ncview-1.93g/bin:.:/data4/jpli/rsm/libs_single/etc
CPU=x86_64
JAVA_BINDIR=/usr/lib64/jvm/jre/bin
INPUTRC=/home/jpli/.inputrc
PWD=/home/jpli
NCARG_ROOT=/software/ncarg-pgi
JAVA_HOME=/usr/lib64/jvm/jre
NCARG=/software/ncarg-pgi
LANG=en_US.UTF-8
PYTHONSTARTUP=/etc/pythonstart
PGRSH=ssh
NCARG_LIB=/software/ncarg-pgi/lib
QT_SYSTEM_DIR=/usr/share/desktop-data
SHLVL=1
HOME=/home/jpli
LESS_ADVANCED_PREPROCESSOR=no
OSTYPE=linux
LS_OPTIONS=-N --color=tty -T 0
WINDOWMANAGER=/usr/bin/kde
NETCDF=/home/jpli/software/netcdf-intel
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
LESS=-M -I
MACHTYPE=x86_64-suse-linux
LOGNAME=jpli
CVS_RSH=ssh
GADDIR=/software/grads/dat
XDG_DATA_DIRS=/usr/share:/etc/opt/kde3/share:/opt/gnome/share:/opt/kde3/share
SSH_CONNECTION=172.16.102.36 54010 192.168.0.101 22
LESSOPEN=lessopen.sh %s
INFOPATH=/usr/local/info:/usr/share/info:/usr/info
DISPLAY=localhost:12.0
INCLUDE=/home/jpli/software/intel/Compiler/11.1/072/mkl/include:/home/jpli/software/intel/Compiler/11.1/072/mkl/include
XAUTHLOCALHOSTNAME=databank
LESSCLOSE=lessclose.sh %s %s
G_BROKEN_FILENAMES=1
I_MPI_ROOT=/home/jpli/software/intel/impi/3.2.0.011
JAVA_ROOT=/usr/lib64/jvm/jre
COLORTERM=1
mc=() {  . /usr/share/mc/bin/mc-wrapper.sh
}
OLDPWD=/home/jpli/coreutils-8.5/man
_=/usr/bin/env
jpli@databank:~> uname -a
Linux databank 2.6.27.7-9-default #1 SMP 2008-12-04 18:10:04 +0100 x86_64 x86_64 x86_64 GNU/Linux
jpli@databank:~> date --version
date (GNU coreutils) 6.12
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
jpli@databank:~> lsb_release -a
LSB Version: core-2.0-noarch:core-3.2-noarch:core-2.0-x86_64:core-3.2-x86_64:desktop-3.2-amd64:desktop-3.2-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch
Distributor ID: SUSE LINUX
Description: openSUSE 11.1 (x86_64)
Release: 11.1
Codename: n/a

I've tried other machines with a different operating system(RHEL), and the core-utils versions at these systems differ(5.97, 5.2.1), The newest version of gnu core-utils was downloaded and compiled on the SUSE machine I use.
Whatever means I try, the same problem appear. So I assumed this to be a bug.

I'm from china by the way, and the time zone I am in and to which the systems were set is GMT8(or CST, China Standard Time).
 
Would you please check over the problem.
 I've not looked at any "Known Bugs" list because I didn't find one. If the problem happens to appear on the list.Would you please send me one.

The Script:
#!/bin/bash
st_year="1991"
st_month="04"
st_day="15"
ed_year="1991"
ed_month="09"
ed_day="01"
ed_date=$ed_year$ed_month$ed_day
year=$st_year
month=$st_month
day=$st_day
while true
do
    cur_date="$year$month$day"
    echo $cur_date
    if [ "$cur_date" = "$ed_date" ]
    then
        break
    fi
    nex_date=$(date +%Y%m%d -d "$year-$month-$day +1 day")
    year=$(echo $nex_date | cut -c1-4)
    month=$(echo $nex_date | cut -c5-6)
    day=$(echo $nex_date | cut -c7-8)
done
--

Jiapeng Li([email-masked])
 
Dpeartment of Atmospheric Sciences
Nanjing University
Hankou Road 22
Nanjing, Jiangsu, China

您想拥有和网易免费邮箱一样强大的软件吗？