From 13b293d8cdef1d3fc167db714961b2adadc86e69 Mon Sep 17 00:00:00 2001 From: Michael K Date: Fri, 28 Nov 2014 16:55:58 +0100 Subject: [PATCH] Added a new function; time till next update as time.Duration --- feed.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/feed.go b/feed.go index e40290a..2761deb 100644 --- a/feed.go +++ b/feed.go @@ -264,6 +264,11 @@ func (this *Feed) SecondsTillUpdate() int64 { return int64(this.CacheTimeout*60) - int64(elapsed.Seconds()) } +// Returns the duration needed to elapse before the feed should update. +func (this *Feed) TillUpdate() (time.Duration, error) { + return time.ParseDuration(fmt.Sprintf("%ds", SecondsTillUpdate())) +} + func (this *Feed) buildFeed(doc *xmlx.Document) (err error) { switch this.Type { case "rss":