Added a new function; time till next update as time.Duration

This commit is contained in:
Michael K 2014-11-28 16:55:58 +01:00
parent ee66dbdb55
commit 13b293d8cd
1 changed files with 5 additions and 0 deletions

View File

@ -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":