Last modified: 2014-09-24 00:05:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21516, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19516 - function userAdjust() handles system time zone incorrectly ({{REVISIONTIMESTAMP}} for other times of year wrong)
function userAdjust() handles system time zone incorrectly ({{REVISIONTIMESTA...
Status: NEW
Product: MediaWiki
Classification: Unclassified
User preferences (Other open bugs)
unspecified
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://de.wikipedia.org/w/index.php?t...
: patch, patch-reviewed
Depends on: 32297
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-04 13:29 UTC by Umherirrender
Modified: 2014-09-24 00:05 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
untested patch (1.45 KB, patch)
2010-03-26 20:49 UTC, Umherirrender
Details

Description Umherirrender 2009-07-04 13:29:41 UTC
function userAdjust() in Language.php handled user time zone not correct. This affect time zone with clock shifts, for example "Europe/Berlin".

For example: in summer the winter time is not corrected displayed (and the other way round).

set the time zone in preferences to "Europe/Berlin" (on de.wp). For logged out user and the option 'server default' the time is correct!

After setting the preferences:
the header of version http://de.wikipedia.org/w/index.php?oldid=52264210 show 14:01, 26. Okt. 2008, the included REVISIONTIMESTAMP says 20081026150115 (that was after clock shifts, winter time has an offset from 1 hour to the current summer time) => not equal, offset from 1 hour

the header of version http://de.wikipedia.org/w/index.php?oldid=52230987 show 18:14, 25. Okt. 2008 (summer time, same as current time), REVISIONTIMESTAMP says 20081025181428 => equal


A solution can be: Use wfTimestamp( current user timezone, $date ) to create the adjust time. Use wfTimestamp( TS_MW, $date ) to adjust the server default. Use mktime() if the offset is specify by user.


I am not so familiar with php and mediawiki, so I cannot give you a patch, only this description and idea. I hope, I am on the right lines with it. Thanks.
Comment 1 Umherirrender 2010-03-26 20:49:09 UTC
Created attachment 7249 [details]
untested patch

I have attached a untested patch to show what I mean.
Comment 2 Umherirrender 2010-10-31 07:07:52 UTC
I have created testpages:

* Summertime:
** URL: http://de.wikipedia.org/w/index.php?oldid=80378354
** REVISIONTIMESTAMP: 20101017135817
** LOCALTIMESTAMP: 20101017145817
** UTC-Timestamp of Revision: 2010-10-17T12:58:17Z
* Wintertime:
** URL: http://de.wikipedia.org/w/index.php?oldid=80927014
** REVISIONTIMESTAMP: 20101031075756
** LOCALTIMESTAMP: 20101031075756
** UTC-Timestamp of Revision: 2010-10-31T06:57:56Z

When looking now at summertime, you will see that REVISIONTIMESTAMP and LOCALTIMESTAMP are not the same (differ by one hour).
Comment 3 p858snake 2011-04-30 00:09:50 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 4 Brion Vibber 2011-09-15 01:24:59 UTC
Ahh I think I see what's happening. The headers etc which use the user setting are showing correctly -- it's the {{REVISIONTIMESTAMP}} that renders wrong.

{{REVISIONTIMESTAMP}} uses the server-wide timezone setting, which looks like it's getting incorrectly set still through an old old system which only grabs the current offset -- so at the moment we're actually using '120 minutes offset' instead of 'Europe/Berlin' as the server default. D'oh!

Edited after end of summer time:
http://de.wikipedia.org/w/index.php?oldid=52264210 shows:
• header UTC: 2008-10-26 um 13:01:15
• header set to Europe/Berlin: 2008-10-26 um 14:01:15 <- +1 RIGHT
• REVISIONTIMESTAMP: 20081026150115 <- +2 WRONG

Edited during summer time:
http://de.wikipedia.org/w/index.php?oldid=52230987 shows:
• header UTC: 2008-10-25 um 16:14:28
• header set to Europe/Berlin: 2008-10-25 um 18:14:28 <- +2 RIGHT
• REVISIONTIMESTAMP: 20081025181428 <- +2 RIGHT


This bit in CommonSettings.php needs to be removed:


if ( !isset( $wgLocaltimezone ) ) $wgLocaltimezone = 'UTC';
# Ugly hack warning! This needs smoothing out.
if ( $wgLocaltimezone ) {
    $oldtz = getenv( 'TZ' );
    putenv( "TZ=$wgLocaltimezone" );
    $wgLocalTZoffset = date( 'Z' ) / 60;
    putenv( "TZ=$oldtz" );
}

... and alas similar code appears to be in Setup.php now. :P

Language::userAdjust's path through 'System' or tz being '' should probably be pulled up and run through the date_create / date_timezone_set stuff if $wgLocaltimezone is set, preferable to $wgLocalTZOffset.

Or at least they need to be sorted out in some way. :P
Comment 5 Sumana Harihareswara 2011-11-09 04:03:41 UTC
Umherirrender, I am sorry to say that your patch no longer applies cleanly to trunk.  Could you possibly update it and resubmit?  Thank you!
Comment 6 Umherirrender 2011-11-12 21:47:37 UTC
(In reply to comment #5)
> Umherirrender, I am sorry to say that your patch no longer applies cleanly to
> trunk.  Could you possibly update it and resubmit?  Thank you!

No, I am not very familar with php and its date/time function. I have created that patch only to show the problem better, not as solution.

Please mark the patch as obsolete.

bug 32297 seems a way in the right way.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links