From 96c5543647d84a27479bb95511eeec41c73c3ff1 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 26 Mar 2007 02:32:33 +0000 Subject: [PATCH] Account for wgDBtimezone if set. DBs not using it (mysql) will have it = 0 and return same time as always. --- includes/GlobalFunctions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index dedd361913..620704739d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1317,7 +1317,7 @@ function wfArrayLookup( $a, $b ) { */ function wfTimestampNow() { # return NOW - return wfTimestamp( TS_MW, time() ); + return wfTimestamp( TS_MW, 0 ); } /** @@ -1404,10 +1404,11 @@ define('TS_POSTGRES', 7); * @return string Time in the format specified in $outputtype */ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { + global $wgDBtimezone; $uts = 0; $da = array(); if ($ts==0) { - $uts=time(); + $uts=time() - 60*60*$wgDBtimezone; } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) { # TS_DB $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], -- 2.20.1