LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-03-2007, 11:18 AM   #1
georgewr3
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Rep: Reputation: 0
DST/Time zone question


I'm trying to get DST for East Brazil working correctly with SuSe 10.2, PHP 5.2 and PostGreSQL 8.1.5. Apparently a change was made very recently in Brazil to move the beginning of DST there from 10/20-10/21 to 10/13-10/14. (They switch right at midnight to 1am in the fall, and 11pm in the spring - opposite of the U.S.)

I have updated the timezone files via the zic command and placed the files at /usr/share/zoneinfo and /usr/share/postgresql/timezone. When I run a PostGreSQL shell and execute selects, the DST does occur at 10/13-10/14. Before I updated the timezone files, the queries showed the DST change at 10/20-10/21 which was correct up until the recent change in Brazilian DST. I got the newest timezone files from ftp://elsie.nci.nih.gov/pub/tzdata2007h.tar.gz which has the lastest Brazilian change.

However when using PHP's date function (which defers to O/S) it shows the DST change at Nov. 4th rather than 10/14. I have YAST set to Brazil East.

Is there another O/S patch that I need to get?

Thanks for any help.
 
Old 10-04-2007, 04:33 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, and welcome to LQ!

A quick google for "php timezone DST wrong" suggests that there
are buggy PHP versions out there ...


Cheers,
Tink
 
Old 10-04-2007, 10:28 AM   #3
georgewr3
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you.

I searched as well but didn't find anything conclusive. I did see that the last mention of DST was with version 5.0 of PHP but I'm using 5.2. I would think that apps would defer to the O/S to get the time to provide a single point of success/failure. Did you see a specific mention of this being a PHP failure?
 
Old 10-04-2007, 01:58 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
I searched as well but didn't find anything conclusive. I did see that the last mention of DST was with version 5.0 of PHP but I'm using 5.2.
I saw references to varied versions of 5 (5.0 - 5.1.5), and
many people stating that things were normal with 4.x ... and
reports that it was working 5.1.6.

Maybe a bug was re-introduced in the 5.2 you're using?

Quote:
Did you see a specific mention of this being a PHP failure?
Well ... if the OS reports the correct time, and the RDBMS
reports the correct time; but the PHP code doesn't. PHP
looks like a quite probable candidate. Did you restart
your machine after patching the time-zone file? Or at least
made sure that all services got restarted? Theoretically
it could still be apache, but you should see that in apache's
log; and you can test PHP from the command-line just for
good measure.

Code:
$ date;php -r "echo strftime('%Y-%m-%d %H:%M:%S %Z%n');";php --version
Cheers,
Tink

Last edited by Tinkster; 10-04-2007 at 02:02 PM. Reason: second half
 
Old 10-04-2007, 02:09 PM   #5
georgewr3
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Original Poster
Rep: Reputation: 0
It appears it is indeed a problem with PHP specifically. For some strange reason versions after 5.1 now ship with their own version of the timezone database.

http://derickrethans.nl/the_y2k7_problem.php

I can't think of a reason why that's desireable since it's one more thing that can break.

I appreciate the follow up, thank you.
 
Old 10-04-2007, 02:11 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
*sigh*

I never liked PHP much, and that's just another good reason ;}

Thanks for finding that one - I'm sure it will be handy for
others to know as well!


Cheers,
Tink
 
Old 10-11-2007, 04:52 PM   #7
georgewr3
LQ Newbie
 
Registered: Oct 2007
Posts: 7

Original Poster
Rep: Reputation: 0
The problem has been fixed.

http://pecl.php.net/get/timezonedb

timezonedb-2007.8 should fix the problem.
 
  


Reply

Tags
daylight, dst, php, saving, time, tz


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RedHat Release 9 and Daylight Savings Time (DST) hbloom Linux - General 10 10-07-2009 01:06 AM
DST Time Change in Australia not working prpersonal Linux - General 6 10-11-2007 05:58 PM
Cannot set time/date to other time zone than UTC (Kubuntu) jamangold Ubuntu 1 12-23-2005 06:42 PM
modification time off 1 hour between linux and windows after DST adjustment pvlogin Linux - Software 3 11-01-2005 10:51 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration