jenkins-bot has submitted this change and it was merged.

Change subject: time: Implement ConvertableTimestamp::now()
......................................................................


time: Implement ConvertableTimestamp::now()

Shortcut for ConvertableTimestamp::convert() for the current time.

Change-Id: I1c34c0a59bb57652c7a2e959836c8ba400a25f49
---
M includes/GlobalFunctions.php
M includes/libs/time/ConvertableTimestamp.php
2 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 0360d19..6e8ce8f 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2033,7 +2033,7 @@
  */
 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 a4c79ba..a784dc6 100644
--- a/includes/libs/time/ConvertableTimestamp.php
+++ b/includes/libs/time/ConvertableTimestamp.php
@@ -178,6 +178,16 @@
        }
 
        /**
+        * 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.
         *
         * Convert the internal timestamp to the specified format and then

-- 
To view, visit https://gerrit.wikimedia.org/r/312167
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1c34c0a59bb57652c7a2e959836c8ba400a25f49
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to