* (bug 23284) Times are now rounded correctly
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 29 Apr 2010 15:09:22 +0000 (15:09 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 29 Apr 2010 15:09:22 +0000 (15:09 +0000)
RELEASE-NOTES
languages/Language.php

index f22b887..0c17aff 100644 (file)
@@ -140,6 +140,7 @@ in a negative namespace (which is invalid).
   to enhance preference grouping.
 * (bug 23298) Interwiki links with prefix only in log summaries now link to the
   correct link
+* (bug 23284) Times are now rounded correctly
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent
index e86e609..0fbba3b 100644 (file)
@@ -2847,12 +2847,26 @@ class Language {
                } elseif ( $seconds < 60 ) {
                        return $this->formatNum( round( $seconds ) ) . ' ' . wfMsg( 'seconds-abbrev' );
                } elseif ( $seconds < 3600 ) {
-                       return $this->formatNum( floor( $seconds / 60 ) ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
-                               $this->formatNum( round( fmod( $seconds, 60 ) ) ) . ' ' . wfMsg( 'seconds-abbrev' );
+                       $minutes = floor( $seconds / 60 );
+                       $secondsPart = round( fmod( $seconds, 60 ) );
+                       if ( $secondsPart == 60 ) {
+                               $secondsPart = 0;
+                               $minutes++;
+                       }
+                       return $this->formatNum( $minutes ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
+                               $this->formatNum( $secondsPart ) . ' ' . wfMsg( 'seconds-abbrev' );
                } else {
                        $hours = floor( $seconds / 3600 );
                        $minutes = floor( ( $seconds - $hours * 3600 ) / 60 );
                        $secondsPart = round( $seconds - $hours * 3600 - $minutes * 60 );
+                       if ( $secondsPart == 60 ) {
+                               $secondsPart = 0;
+                               $minutes++;
+                       }
+                       if ( $minutes == 60 ) {
+                               $minutes = 0;
+                               $hours++;
+                       }
                        return $this->formatNum( $hours ) . ' ' . wfMsg( 'hours-abbrev' ) . ' ' .
                                $this->formatNum( $minutes ) . ' ' . wfMsg( 'minutes-abbrev' ) . ' ' .
                                $this->formatNum( $secondsPart ) . ' ' . wfMsg( 'seconds-abbrev' );