From c407994dd3aeb2c5a8e5f3fa070e7436fe308fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 27 Feb 2021 23:39:51 +0100 Subject: Remove obsolete feeds from cache after 180 days --- pkg/util/util.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg') diff --git a/pkg/util/util.go b/pkg/util/util.go index 88d04c0..bacb494 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -21,3 +21,8 @@ func TimeFormat(t time.Time) string { return t.Format(time.ANSIC) } + +// Days returns the number of days in a duration. Fraction of days are discarded. +func Days(d time.Duration) int { + return int(d.Hours() / 24) +} -- cgit v1.2.3