r61414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61413‎ | r61414 | r61415 >
Date:15:05, 23 January 2010
Author:catrope
Status:reverted (Comments)
Tags:
Comment:
Followup to r61412: don't use time(), we have our own function for this
Modified paths:
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -154,7 +154,7 @@
155155 $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
156156 $data['server'] = $GLOBALS['wgServer'];
157157 $data['wikiid'] = wfWikiID();
158 - $data['time'] = wfTimestamp( TS_ISO_8601, time() );
 158+ $data['time'] = wfTimestampNow( TS_ISO_8601 );
159159
160160 return $this->getResult()->addValue( 'query', $property, $data );
161161 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r61455Revert r61414 per CR comment: wfTimestampNow() doesn't take a TS_* parametercatrope10:05, 24 January 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61412* (bug 22240) - API: include time in siteinfo...reedy12:37, 23 January 2010

Comments

#Comment by Gurch (talk | contribs)   07:24, 24 January 2010

Roan, while we do have our own function, it doesn't take a format argument as your code seems to assume:

function wfTimestampNow() {
	# return NOW
	return wfTimestamp( TS_MW, time() );
}

As a result this changes the output to '20100124071509' format rather than '2010-01-24T07:15:09Z', which isn't consistent with timestamps elsewhere in the API. I suppose it might be better to modify wfTimestampNow() than use time() directly, but there was a reason behind it. :)

#Comment by Tim Starling (talk | contribs)   01:03, 29 January 2010

If you omit the second parameter from wfTimestamp(), it uses the current time, there's no need to call time() explicitly. So wfTimestamp() already does what you want wfTimestampNow() to do.

#Comment by Gurch (talk | contribs)   01:30, 29 January 2010

Ah, sorry, missed that. It can be replaced by wfTimestamp( TS_ISO_8601 ); then. Roan's version was still wrong though :)

Status & tagging log