Files
Timmy Welch e374614124 Move hashing code into ch/ and comic-hasher to the repo root
So `go install gitea.narnian.us/lordwelch/comic-hasher@latest` works
2026-11-05 16:28:41 -08:00

26 lines
392 B
Go

package ch
import (
"time"
"gitea.narnian.us/lordwelch/comic-hasher/log"
)
type TimeLog struct {
total time.Duration
last time.Time
}
func (t *TimeLog) ResetTime() {
t.total = 0
t.last = time.Now()
}
func (t *TimeLog) LogTime(msg string) {
now := time.Now()
diff := now.Sub(t.last)
t.last = now
t.total += diff
log.Log(log.Trace, "total: %v, %s: %v\n", t.total, msg, diff)
}