From: Kunal Mehta Date: Thu, 22 Sep 2016 03:28:42 +0000 (-0700) Subject: time: Implement ConvertableTimestamp::now() X-Git-Tag: 1.31.0-rc.0~5396^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=316b4a404bfbcd91c78e9d3a94e81c69d58a4909;p=lhc%2Fweb%2Fwiklou.git time: Implement ConvertableTimestamp::now() Shortcut for ConvertableTimestamp::convert() for the current time. Change-Id: I1c34c0a59bb57652c7a2e959836c8ba400a25f49 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0360d19731..6e8ce8f2c8 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2033,7 +2033,7 @@ function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) { */ function wfTimestampNow() { # return NOW - return MWTimestamp::convert( TS_MW, time() ); + return MWTimestamp::now( TS_MW ); } /** diff --git a/includes/libs/time/ConvertableTimestamp.php b/includes/libs/time/ConvertableTimestamp.php index a4c79babb5..a784dc619b 100644 --- a/includes/libs/time/ConvertableTimestamp.php +++ b/includes/libs/time/ConvertableTimestamp.php @@ -177,6 +177,16 @@ class ConvertableTimestamp { } } + /** + * Get the current time in the given format + * + * @param int $style Constant Output format for timestamp + * @return string + */ + public static function now( $style = TS_MW ) { + return static::convert( $style, time() ); + } + /** * Get the timestamp represented by this object in a certain form. *