Last modified: 2006-09-09 23:09:07 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 );
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.
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.