From b6a52bbf24ad2b584844c365cbfa9a4f13f7cc93 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 9 May 2011 20:11:50 +0100 Subject: [PATCH] Added SecondsTillUpdate() method. --- feed.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/feed.go b/feed.go index 0e8689f..8e03eaf 100644 --- a/feed.go +++ b/feed.go @@ -159,6 +159,13 @@ func (this *Feed) CanUpdate() bool { return true } +// Returns the number of seconds needed to elapse +// before the feed should update. +func (this *Feed) SecondsTillUpdate() int64 { + utc := time.UTC() + return int64(this.CacheTimeout*60)-(utc.Seconds()-this.lastupdate) +} + func (this *Feed) buildFeed(doc *xmlx.Document) (err os.Error) { switch this.Type { case "rss":