aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-27 23:39:51 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-27 23:40:00 +0100
commitc407994dd3aeb2c5a8e5f3fa070e7436fe308fc9 (patch)
tree79adc06c0a5865badd83bfd0f515c21791d81d2b /pkg
parent21210173c4d04676436b8e48dfbe4043299797cb (diff)
downloadfeed2imap-go-c407994dd3aeb2c5a8e5f3fa070e7436fe308fc9.tar.gz
feed2imap-go-c407994dd3aeb2c5a8e5f3fa070e7436fe308fc9.tar.bz2
feed2imap-go-c407994dd3aeb2c5a8e5f3fa070e7436fe308fc9.zip
Remove obsolete feeds from cache after 180 days
Diffstat (limited to 'pkg')
-rw-r--r--pkg/util/util.go5
1 files changed, 5 insertions, 0 deletions
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)
+}