gotosocial/vendor/codeberg.org/gruf/go-logger/clock.go

22 lines
311 B
Go
Raw Normal View History

2021-11-13 12:29:08 +01:00
package logger
import (
"sync"
"time"
"codeberg.org/gruf/go-nowish"
)
var (
clock = nowish.Clock{}
clockOnce = sync.Once{}
)
2021-11-27 15:26:58 +01:00
// startClock starts the global nowish clock.
2021-11-13 12:29:08 +01:00
func startClock() {
clockOnce.Do(func() {
clock.Start(time.Millisecond * 10)
clock.SetFormat("2006-01-02 15:04:05")
})
}