- return $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' ) . ' ' .
- $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' ) . ' ' .
- $this->formatNum( $secondsPart ) . $this->getMessageFromDB( 'seconds-abbrev' );
+ $s = $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
+ $s .= ' ';
+ $s .= $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' );
+ if ( !in_array( $format, array( 'avoidseconds', 'avoidminutes' ) ) ) {
+ $s .= ' ' . $this->formatNum( $secondsPart ) .
+ $this->getMessageFromDB( 'seconds-abbrev' );
+ }
+ } else {
+ $days = floor( $seconds / 86400 );
+ if ( $format === 'avoidminutes' ) {
+ $hours = round( ( $seconds - $days * 86400 ) / 3600 );
+ if ( $hours == 24 ) {
+ $hours = 0;
+ $days++;
+ }
+ $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
+ $s .= ' ';
+ $s .= $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
+ } elseif ( $format === 'avoidseconds' ) {
+ $hours = floor( ( $seconds - $days * 86400 ) / 3600 );
+ $minutes = round( ( $seconds - $days * 86400 - $hours * 3600 ) / 60 );
+ if ( $minutes == 60 ) {
+ $minutes = 0;
+ $hours++;
+ }
+ if ( $hours == 24 ) {
+ $hours = 0;
+ $days++;
+ }
+ $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
+ $s .= ' ';
+ $s .= $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
+ $s .= ' ';
+ $s .= $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' );
+ } else {
+ $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
+ $s .= ' ';
+ $s .= $this->formatTimePeriod( $seconds - $days * 86400, $format );
+ }