catbase/bot/stats/stats.go

20 lines
281 B
Go
Raw Permalink Normal View History

2024-02-28 19:32:28 +00:00
package stats
import (
"time"
)
type Stats struct {
MessagesSent int
MessagesRcv int
startTime time.Time
}
func New() *Stats {
return &Stats{startTime: time.Now()}
}
2024-02-28 22:05:23 +00:00
func (s Stats) Uptime() string {
return time.Now().Sub(s.startTime).Truncate(time.Second).String()
2024-02-28 19:32:28 +00:00
}