diff options
author | Timo Besenreuther <timo.besenreuther@gmail.com> | 2013-03-28 16:23:29 +0400 |
---|---|---|
committer | Timo Besenreuther <timo.besenreuther@gmail.com> | 2013-03-28 16:23:29 +0400 |
commit | 611922c647f8dfefffb472bd077d5c77ab99509b (patch) | |
tree | df231e1716223acf557513367e56b84c260d455e /core/Piwik.php | |
parent | ae4b03163792f0b6e933933e5d37df87dc3fd566 (diff) |
refs #1700 better time formatting for milliseconds
Diffstat (limited to 'core/Piwik.php')
-rw-r--r-- | core/Piwik.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/Piwik.php b/core/Piwik.php index a1ffc1df27..0fb50979bc 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -1419,7 +1419,7 @@ class Piwik $time = sprintf("%02s", $hours) . ':' . sprintf("%02s", $minutes) . ':' . sprintf("%02s", $seconds); $milliSeconds = ($numberOfSeconds * 1000) % 1000; if ($milliSeconds) { - $time .= '.' . $milliSeconds; + $time .= '.' . sprintf("%03s", $milliSeconds); } return $time; } @@ -1435,6 +1435,8 @@ class Piwik $minutes = floor($minusDaysAndHours / 60); $seconds = $minusDaysAndHours - $minutes * 60; + + $milliSeconds = ($numberOfSeconds * 1000) % 1000; if ($years > 0) { $return = sprintf(Piwik_Translate('General_YearsDays'), $years, $days); @@ -1444,6 +1446,8 @@ class Piwik $return = sprintf(Piwik_Translate('General_HoursMinutes'), $hours, $minutes); } elseif ($minutes > 0) { $return = sprintf(Piwik_Translate('General_MinutesSeconds'), $minutes, $seconds); + } elseif ($milliSeconds > 0 && $seconds < 1) { + $return = sprintf(Piwik_Translate('General_Milliseconds'), $milliSeconds); } else { $return = sprintf(Piwik_Translate('General_Seconds'), $seconds); } |