[MediaWiki-commits] [Gerrit] mediawiki/core[master]: time: Implement ConvertableTimestamp::now()

2016-09-21 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: time: Implement ConvertableTimestamp::now()

2016-09-21 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312167

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

time: Implement ConvertableTimestamp::now()

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

Change-Id: I1c34c0a59bb57652c7a2e959836c8ba400a25f49
---
M includes/libs/time/ConvertableTimestamp.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/312167/1

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: newchange
Gerrit-Change-Id: I1c34c0a59bb57652c7a2e959836c8ba400a25f49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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