summaryrefslogtreecommitdiff
path: root/internal/schedule
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-10 10:34:26 +0300
committerPaul Buetow <paul@buetow.org>2024-10-10 10:34:26 +0300
commit2f006df7a6aff97bb69bb2b6ffd607890863ebf9 (patch)
treeecbe059b685d94cafb0b6e0e3b01b1d5bb36bd44 /internal/schedule
parentbe3abe2462bca511ede21cacd1e5a3690b5aa745 (diff)
initial timestamp package
Diffstat (limited to 'internal/schedule')
-rw-r--r--internal/schedule/stats.go15
1 files changed, 3 insertions, 12 deletions
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)
}