Last modified: 2006-09-09 23:09:07 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 T9272, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7272 - Wrong server time and timestamp in Parser.php and SpecialPreferences.php
Wrong server time and timestamp in Parser.php and SpecialPreferences.php
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Normal trivial with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-09 00:18 UTC by Guido
Modified: 2006-09-09 23:09 UTC (History)
0 users

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


Attachments

Description Guido 2006-09-09 00:18:35 UTC
Hi,

{{CURRENTTIME}} and {{CURRENTTIMESTAMP}} shows the wrong server time. The
problem is in the file 'includes/Parser.php'. This variables are filled by the
function 'wfTimestamp()' with 'gmmkdate()' which returns a date of GMT, but my
server is in germany (GMT +02:00). All other variables e.g. CURRENTDAY are
filled by normal date function which return the correct server time.

Example:
local server time: 09/09/2006 0:30
{{CURRENTTIME}} = 22:30 - wrong
{{CURRENTDAY}} = 9 - right
{{CURRENTMONTH}} = 09 - right

Fix in the Parser.php
case MAG_CURRENTTIME:
- return $varCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ),
false, false );
+ return $varCache[$index] = $wgContLang->time( date( 'YmdHis', $ts ), false,
false );

case MAG_CURRENTTIMESTAMP:
- return $varCache[$index] = wfTimestampNow();
+ return $varCache[$index] = date( 'YmdHis', $ts );


The same problem is on the user preferences.
Fix in the SpecialPreferences.php
- $nowserver = $wgLang->time( $now, false );
+ $nowserver = $wgLang->time( date( 'YmdHis', time() ), false );
Comment 1 Rotem Liss 2006-09-09 07:56:44 UTC
It may be a duplicate of Bug 366, but I don't think so, as all the other
{{CURRENTx}} variables use the server time, not GMT ({{LOCALx}} even use
$wgLocaltimezone, and never use GMT).

About the preferences, it's not a bug: $nowserver should be GMT in the
preferences page.
Comment 2 Guido 2006-09-09 23:09:07 UTC
Ok, you can set the bug invalid, but there is still a bug. Today I took the last
trunk version 1.8alpha to verify if the bug is fixed. If I understand it
correctly, then {{CURRENT*}} should indicate the UTC and {{LOCAL*}} the local
server time.

The bug is correct fixed only if you set $wgLocaltimezone.

Otherwise e.g. you receives this: 

{{CURRENTTIMESTAMP}} 20060909220135 - correct
{{LOCALTIMESTAMP}} 20060910000135 - correct
{{CURRENTDAY}} 10 - incorrect 
{{LOCALDAY}} 10 - correct
{{CURRENTDOW}} 0 - incorrect 
{{LOCALDOW}} 0 - correct
{{CURRENTHOUR}} 00 - incorrect
{{LOCALHOUR}} 00 - correct
{{CURRENTTIME}} 22:01 - correct
{{LOCALTIME}} 00:01 - correct


About the preferences: ok, it's not a bug it's a inexactly german translation.

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


Navigation
Links