diff --git a/common/stats/session/utils.go b/common/stats/session/utils.go index 1585a80..3f395d4 100644 --- a/common/stats/session/utils.go +++ b/common/stats/session/utils.go @@ -27,12 +27,19 @@ func process(name string) string { return name } -func duration(start, end time.Time) time.Duration { +func duration(start, end time.Time) (t time.Duration) { if end.IsZero() { - return time.Now().Sub(start).Round(time.Millisecond) + t = time.Now().Sub(start) } else { - return end.Sub(start).Round(time.Millisecond) + t = end.Sub(start) } + + if t < 1*time.Second { + t = t.Round(time.Millisecond) + } else { + t = t.Round(time.Second) + } + return } func uptime() string {