Permalink
Browse files

fix format-interval trimming to trim minor part only when major part …

…is big
  • Loading branch information...
hypatia2 committed Oct 27, 2015
1 parent 4c699bc commit 7d4bd21907150c6db033d7e78237c5ef225bff63
Showing with 3 additions and 3 deletions.
  1. +3 −3 fruho/main.tcl
@@ -1353,22 +1353,22 @@ proc format-mega {n {trim 0}} {
}
# trim - trim the minor unit
# trim - trim the minor unit if major > 5
proc format-interval {sec {trim 0}} {
set min [expr {$sec/60}]
# if more than 24 hour
if {$min > 1440} {
set days [expr {$min/1440}]
set hours [expr {($min-$days*1440)/60}]
if {$trim} {
if {$trim && $days > 5} {
return "${days}d"
} else {
return "${days}d ${hours}h"
}
} else {
set hours [expr {$min/60}]
set minutes [expr {$min-($hours*60)}]
if {$trim} {
if {$trim && $hours > 5} {
return "${hours}h"
} else {
return "${hours}h ${minutes}m"

0 comments on commit 7d4bd21

Please sign in to comment.