From 2f006df7a6aff97bb69bb2b6ffd607890863ebf9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 10 Oct 2024 10:34:26 +0300 Subject: initial timestamp package --- internal/schedule/stats.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'internal/schedule') diff --git a/internal/schedule/stats.go b/internal/schedule/stats.go index 847aead..172272f 100644 --- a/internal/schedule/stats.go +++ b/internal/schedule/stats.go @@ -7,8 +7,8 @@ import ( "time" "codeberg.org/snonux/gos/internal/entry" - "codeberg.org/snonux/gos/internal/format" "codeberg.org/snonux/gos/internal/oi" + "codeberg.org/snonux/gos/internal/timestamp" ) // Posting stats @@ -45,7 +45,7 @@ func (s stats) targetHit() bool { func (s *stats) gatherPostedStats(dir string, lookbackTime time.Time) error { var ( - now time.Time = nowTime() + now time.Time = timestamp.NowTime() oldest time.Time = now ) @@ -95,15 +95,6 @@ func (s *stats) gatherQueuedStats(dir string) error { return err } -// Make a simpler "now" time which gets rid of any extra information like offsets etc. -func nowTime() time.Time { - simplerNow, err := time.Parse(format.Time, time.Now().Format(format.Time)) - if err != nil { - panic(err) - } - return simplerNow -} - func pastTime(duration time.Duration) time.Time { - return nowTime().Add(-duration) + return timestamp.NowTime().Add(-duration) } -- cgit v1.2.3