Browse Source

update stats duration format

pull/15/head
Jason 5 years ago
parent
commit
a7ffd55bab
  1. 13
      common/stats/session/utils.go

13
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 {

Loading…
Cancel
Save