Update time duration calculation

This commit is contained in:
r 2020-09-22 04:43:07 +00:00
parent 79d4ff4b08
commit c753a74f49
1 changed files with 4 additions and 4 deletions

View File

@ -80,19 +80,19 @@ func DurToStr(dur time.Duration) string {
return strconv.Itoa(int(s)) + "s"
}
m := dur.Minutes()
if m < 60 {
if m < 60*2 {
return strconv.Itoa(int(m)) + "m"
}
h := dur.Hours()
if h < 24 {
if h < 24*2 {
return strconv.Itoa(int(h)) + "h"
}
d := h / 24
if d < 30 {
if d < 30*2 {
return strconv.Itoa(int(d)) + "d"
}
mo := d / 30
if mo < 12 {
if mo < 12*2 {
return strconv.Itoa(int(mo)) + "mo"
}
y := mo / 12