Current time: 04-20-2014, 10:48 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DST correction
11-04-2007, 09:58 PM
Post: #1
DST correction
I notice my time was off an hour on the forums and I checked my options as well as the default DST setting for the board. These were set correctly. If the DST option is checked in the user CP, it will add an hour regardless. If you open inc/functions.php and go to line 280, you find the var $offset++ is set when the user has DST enabled. This should only increment in the Spring. Adding a conditional to test for DST fixes this.

Code:
date( 'I' ) tests false until April 2008.

replace:

$offset++;

with:

if ( date( 'I' ) )
{
    $offset++;
}
Find all posts by this user
Quote this message in a reply
11-05-2007, 03:34 AM
Post: #2
RE: DST correction
while using date('I') will work for the server (eg default time zone), you cannot use it for users. Different places have different rules regarding daylight savings (when to start, when to stop, or whether to observe at all).

The best way to accomplish what you propose is to store the name of the timezone (eg America/Denver) and use PEAR packages to deal with it.
Find all posts by this user
Quote this message in a reply
11-05-2007, 04:09 AM
Post: #3
RE: DST correction
The "Enable Daylight Savings Time correction" option essentially treats the user time as observing DST if enabled. If left enabled, it supplies the offset regardless of DST ending. date('I') simply tells me that we are not in DST and if the option is enabled, it shouldn't "spring forward" until March 08. Users in areas that don't observe DST shouldn't enable the correction.
Find all posts by this user
Quote this message in a reply
11-05-2007, 08:28 PM
Post: #4
RE: DST correction
date('I') says whether the timezone the server itself is currently observing daylight savings time. What you really want to do is check to see if the user's timezone is currently observing DST, which should be true for most of the southern hemisphere and false for most of the northern hemisphere.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication