summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-25 14:51:00 -0500
committerJeff Carr <[email protected]>2025-10-25 14:51:00 -0500
commit8e670f4d97327b06563af3a38296e63be10e934f (patch)
treea69bfce9c6e8ac3d31f9973b0758a552330d7410
parent3dff430dc8205ef4668b034459c38d4400eb1226 (diff)
needed >=
-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 {