r65654 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65653‎ | r65654 | r65655 >
Date:15:09, 29 April 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* (bug 23284) Times are now rounded correctly
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -2847,12 +2847,26 @@
28482848 } elseif ( $seconds < 60 ) {
28492849 return $this->formatNum( round( $seconds ) ) . ' ' . wfMsg( 'seconds-abbrev' );
28502850 } elseif ( $seconds < 3600 ) {
2851 - return $this->formatNum( floor( $seconds / 60 ) ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
2852 - $this->formatNum( round( fmod( $seconds, 60 ) ) ) . ' ' . wfMsg( 'seconds-abbrev' );
 2851+ $minutes = floor( $seconds / 60 );
 2852+ $secondsPart = round( fmod( $seconds, 60 ) );
 2853+ if ( $secondsPart == 60 ) {
 2854+ $secondsPart = 0;
 2855+ $minutes++;
 2856+ }
 2857+ return $this->formatNum( $minutes ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
 2858+ $this->formatNum( $secondsPart ) . ' ' . wfMsg( 'seconds-abbrev' );
28532859 } else {
28542860 $hours = floor( $seconds / 3600 );
28552861 $minutes = floor( ( $seconds - $hours * 3600 ) / 60 );
28562862 $secondsPart = round( $seconds - $hours * 3600 - $minutes * 60 );
 2863+ if ( $secondsPart == 60 ) {
 2864+ $secondsPart = 0;
 2865+ $minutes++;
 2866+ }
 2867+ if ( $minutes == 60 ) {
 2868+ $minutes = 0;
 2869+ $hours++;
 2870+ }
28572871 return $this->formatNum( $hours ) . ' ' . wfMsg( 'hours-abbrev' ) . ' ' .
28582872 $this->formatNum( $minutes ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
28592873 $this->formatNum( $secondsPart ) . ' ' . wfMsg( 'seconds-abbrev' );
Index: trunk/phase3/RELEASE-NOTES
@@ -140,6 +140,7 @@
141141 to enhance preference grouping.
142142 * (bug 23298) Interwiki links with prefix only in log summaries now link to the
143143 correct link
 144+* (bug 23284) Times are now rounded correctly
144145
145146 === API changes in 1.17 ===
146147 * (bug 22738) Allow filtering by action type on query=logevent

Follow-up revisions

RevisionCommit summaryAuthorDate
r76269Follow-up r65654:...ialex21:05, 7 November 2010

Comments

#Comment by Hashar (talk | contribs)   22:00, 18 October 2010

marking fixme: We should get test cases for this revision to make sure we do not break time rounding again :o)

#Comment by IAlex (talk | contribs)   21:05, 7 November 2010

Done in r76269.

#Comment by Hashar (talk | contribs)   10:54, 11 November 2010

Marking ok

Status & tagging log