From 65658d7066128a4b5b4a1f4b2d8ffd8897fae68f Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 29 Apr 2010 15:09:22 +0000 Subject: [PATCH] * (bug 23284) Times are now rounded correctly --- RELEASE-NOTES | 1 + languages/Language.php | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f22b887fd7..0c17affbb8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/languages/Language.php b/languages/Language.php index e86e609394..0fbba3bdd6 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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' ); -- 2.20.1