[CentOS] Trouble using date function in centos
William L. Maltby
CentOS4Bill at triad.rr.com
Sat Oct 4 20:26:23 UTC 2008
On Sat, 2008-10-04 at 21:48 +0200, Thomas Johansson wrote:
> <snip>
> On centos 4.6
> --------------
> test000:/% date -d "2008-10-25 +1 days" "+%Y-%m-%d"
> 2008-10-26
> test000:/% date -d "2008-10-26 +1 days" "+%Y-%m-%d"
> 2008-10-26
> test000:/% uname -a
> Linux test000... 2.6.9-67.ELsmp #1 SMP Fri Nov 16 12:48:03 EST 2007 i686
> i686 i386 GNU/Linux
>
> On centos 4.7
> --------------
> test001:/% date -d "2008-10-25 +1 days" "+%Y-%m-%d"
> 2008-10-26
> test001:/% date -d "2008-10-26 +1 days" "+%Y-%m-%d"
> 2008-10-26
I just typed the above in on the console on my 4.7 node. WFM.
> test001:/% uname -a
> Linux test001... 2.6.9-78.0.1.ELsmp #1 SMP Tue Aug 5 11:02:47 EDT 2008
> i686 athlon i386 GNU/Linux
My kernel doesn't have the "smp", but otherwise matches.
> <snip>
Another posted the possibility of TZ issues. Seems unlikely to me since
you are providing a date string that does not require the system time
zone information. It just converts to the binary offset value from the
epoch, adds the binary equivalent of a day in seconds (IIRC) and formats
the results as a string.
Maybe some library (like the ones used by asctime, ctime, ...) which are
section 3 system calls (those used buy programs like date) are out of
sync? Have you tried the rpm --verify to see if any discrepancies are
reported?
HTH
--
Bill
More information about the CentOS
mailing list