Rare date command bug

This bug is causing me a lot of problems but seems impossible to workarround it. Apparently it just happens with the version 6.9 and with a particular date “2008-03-08 23:59:59”, not another. :mad:
Look!


carlosnblnx:/home/carlos # date --date='+1 seconds 2008-03-08 23:59:59' '+%F %H:%M:%S'
2008-03-08 23:00:00

Should be 2008-03-09 00:00:00!!!

Now with the same month and day but another year


carlosnblnx:/home/carlos # date --date='+1 seconds 2007-03-08 23:59:59' '+%F %H:%M:%S'
2007-03-09 00:00:00

Works!
Finally, same year, day.


carlosnblnx:/home/carlos # date --date='+1 seconds 2008-04-08 23:59:59' '+%F %H:%M:%S'
2008-04-09 00:00:00

I really don’t know why this happens.

date version


carlosnblnx:/srv/www/htdocs/show_stat # date --version
date (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

On Wed, 02 Jul 2008 21:46:04 GMT
castord <castord@no-mx.forums.opensuse.org> wrote:

>
> This bug is causing me a lot of problems but seems impossible to
> workarround it. Apparently it just happens with the version 6.9 and
> with a particular date “2008-03-08 23:59:59”, not another. :mad:
> Look!
>
> Code:
> --------------------
>
> carlosnblnx:/home/carlos # date --date=’+1 seconds 2008-03-08
> 23:59:59’ ‘+%F %H:%M:%S’ 2008-03-08 23:00:00
>
> --------------------
>
> Should be 2008-03-09 00:00:00!!!
>
> Now with the same month and day but another year
>
> Code:
> --------------------
>
> carlosnblnx:/home/carlos # date --date=’+1 seconds 2007-03-08
> 23:59:59’ ‘+%F %H:%M:%S’ 2007-03-09 00:00:00
>
> --------------------
>
> Works!
> Finally, same year, day.
>
> Code:
> --------------------
>
> carlosnblnx:/home/carlos # date --date=’+1 seconds 2008-04-08
> 23:59:59’ ‘+%F %H:%M:%S’ 2008-04-09 00:00:00
>
> --------------------
>
> I really don’t know why this happens.
>
> date version
>
> Code:
> --------------------
>
> carlosnblnx:/srv/www/htdocs/show_stat # date --version
> date (GNU coreutils) 6.9
> Copyright (C) 2007 Free Software Foundation, Inc.
> This is free software. You may redistribute copies of it under the
> terms of the GNU General Public License
> <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the
> extent permitted by law.
> Written by David MacKenzie.
>
> --------------------
>
>
Hi
Works fine here, before and after an update to the timezone data.

malcolml@gnome-vm:~> date --date=’+1 seconds 2008-03-08 23:59:59’ ‘+%F
%H:%M:%S’
2008-03-09 00:00:00

malcolml@gnome-vm:~> date --date=’+1 seconds 2007-03-08 23:59:59’ ‘+%F
%H:%M:%S’
2007-03-09 00:00:00

malcolml@gnome-vm:~> date --date=’+1 seconds 2008-04-08 23:59:59’ ‘+%F
%H:%M:%S’
2008-04-09 00:00:00

malcolml@gnome-vm:~> date --version
date (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the
terms of the GNU General Public License
<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the
extent permitted by law.

Written by David MacKenzie.

malcolml@gnome-vm:~> uname -a
Linux gnome-vm 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC
i686 athlon i386 GNU/Linux

malcolml@gnome-vm:~> cat /etc/SuSE-release
openSUSE 10.3 (i586)
VERSION = 10.3

malcolml@gnome-vm:~> date
Wed Jul 2 17:57:48 CDT 2008

malcolml@gnome-vm:~> rpm -qa |grep timezone
timezone-2007k-3.1

Now an update to timezone data

malcolml@gnome-vm:~> date --date=’+1 seconds 2008-03-08 23:59:59’ ‘+%F
%H:%M:%S’
2008-03-09 00:00:00

malcolml@gnome-vm:~> date --date=’+1 seconds 2007-03-08 23:59:59’ ‘+%F
%H:%M:%S’
2007-03-09 00:00:00

malcolml@gnome-vm:~> date --date=’+1 seconds 2008-04-08 23:59:59’ ‘+%F
%H:%M:%S’
2008-04-09 00:00:00

malcolml@gnome-vm:~> rpm -qa |grep timezone
timezone-2008c-0.1

malcolml@gnome-vm:~> date
Wed Jul 2 18:06:56 CDT 2008

Maybe something to do with your timezone?


Cheers Malcolm °¿° (Linux Counter #276890)
SLED 10.0 SP2 x86_64 Kernel 2.6.16.60-0.23-smp
up 2 days 6:14, 2 users, load average: 0.36, 1.52, 1.24
GPU GeForce 8600 GTS Silent - Driver Version: 173.14.09

Are you using opensuse 10.3? with CentOS 4.1 works fine.
I know that only matters the date --version but I also think that exists the possibility that the OS version could affect the final result.

here my date output


Wed Jul  2 19:19:42 PYT 200

On Wed, 02 Jul 2008 23:36:05 GMT
castord <castord@no-mx.forums.opensuse.org> wrote:

>
> Are you using opensuse 10.3? with CentOS 4.1 works fine.
> I know that only matters the date --version but I also think that
> exists the possibility that the OS version could affect the final
> result.
>
> here my date output
>
> Code:
> --------------------
>
> Wed Jul 2 19:19:42 PYT 200
>
> --------------------
>
>
Hi
Yes that was on 10.3 vmware machine with the 6.9 version. Do you have
the same kernel and timezone rpm?


Cheers Malcolm °¿° (Linux Counter #276890)
SLED 10.0 SP2 x86_64 Kernel 2.6.16.60-0.23-smp
up 2 days 6:54, 1 user, load average: 0.10, 0.07, 0.24
GPU GeForce 8600 GTS Silent - Driver Version: 173.14.09

Yes, same OS, same kenel version.
My timezone is different because I am in Paraguay.
I can’t explain myself how fails just that constant datetime. The timezone should not affect because we are using the same calendar format.

On Thu, 03 Jul 2008 00:26:04 GMT
castord <castord@no-mx.forums.opensuse.org> wrote:

>
> Yes, same OS, same kenel version.
> My timezone is different because I am in Paraguay.
> I can’t explain myself how fails just that constant datetime. The
> timezone should not affect because we are using the same calendar
> format.
>
>
Hi
Ok, are you running ntp?

It sounds like the hardware clock, what is the output for the
following commands as root user?

gnome-vm:~ # hwclock --show
Wed Jul 2 19:38:20 2008 -0.213457 seconds
gnome-vm:~ # date
Wed Jul 2 19:38:24 CDT 2008

What is the computers BIOS time?


Cheers Malcolm °¿° (Linux Counter #276890)
SLED 10.0 SP2 x86_64 Kernel 2.6.16.60-0.23-smp
up 2 days 7:41, 1 user, load average: 0.30, 0.22, 0.18
GPU GeForce 8600 GTS Silent - Driver Version: 173.14.09

NTPD is unused


carlosnblnx:/mnt/ntfs/nfs # hwclock --show
Wed 02 Jul 2008 08:50:21 PM PYT  -0.000868 seconds
carlosnblnx:/mnt/ntfs/nfs # date
Wed Jul  2 20:50:36 PYT 2008

What is the computers BIOS time?

Another problem, it changes every time I reboot or halt the computer. Sometimes, just the time, and some other times, the date.

Thank you for your help! I really appreciate it.

On Thu, 03 Jul 2008 01:06:03 GMT
castord <castord@no-mx.forums.opensuse.org> wrote:

>
> NTPD is unused
>
>
> Code:
> --------------------
>
> carlosnblnx:/mnt/ntfs/nfs # hwclock --show
> Wed 02 Jul 2008 08:50:21 PM PYT -0.000868 seconds
> carlosnblnx:/mnt/ntfs/nfs # date
> Wed Jul 2 20:50:36 PYT 2008
>
> --------------------
>
>
> >
> > What is the computers BIOS time?
> >
> Another problem, it changes every time I reboot or halt the computer.
> Sometimes, just the time, and some other times, the date.
>
> Thank you for your help! I really appreciate it.
>
>
Hi
Sounds like the cmos battery is on the way out. How old is the
computer? Normally they are button ones type CR2032.

In the meantime I would look at enabling ntp via yast and selecting a
couple of time servers to sync with.

It is interesting to note the hwclock is in 12HR mode, but date is in
24HR.

Can you also look in YaST -> system -> /etc/sysconfig editor and look
under System -> Environment -> Clock and advise the settings of the
four items in this section.


Cheers Malcolm °¿° (Linux Counter #276890)
SLED 10.0 SP2 x86_64 Kernel 2.6.16.60-0.23-smp
up 2 days 8:28, 2 users, load average: 0.21, 0.20, 0.22
GPU GeForce 8600 GTS Silent - Driver Version: 173.14.09