summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formatDuration.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/formatDuration.go b/formatDuration.go
index f9cd547..dc4ce2d 100644
--- a/formatDuration.go
+++ b/formatDuration.go
@@ -17,7 +17,6 @@ func FormatDuration(d time.Duration) string {
return result
}
- days := int(d.Hours()) / 24
/* was terrible
// check if it's more than a day
if days > 45 {
@@ -27,21 +26,22 @@ func FormatDuration(d time.Duration) string {
}
*/
- if days > 0 {
+ days := int(d.Hours()) / 24
+ if days >= 2 {
result += fmt.Sprintf("%3d d", days)
return result
}
// check if it's more than an hour
hours := int(d.Hours()) % 24
- if hours > 2 {
+ if hours >= 2 {
result += fmt.Sprintf("%3d h", hours)
return result
}
// check if it's more than a minute
minutes := int(d.Minutes()) % 60
- if minutes > 2 {
+ if minutes >= 2 {
result += fmt.Sprintf("%3d m", minutes)
return result
}
@@ -55,7 +55,7 @@ func FormatDuration(d time.Duration) string {
// report in milliseconds
ms := int(d.Milliseconds())
- if ms > 100 {
+ if ms >= 100 {
// todo: print .3s, etc ?
}
if ms > 0 {