Added Feed.LastUpdate() method. It returns the timestamp of the last time the feed was updated. Value is returned in seconds.
This commit is contained in:
parent
a8057b0c92
commit
f5f5baa34e
|
@ -78,6 +78,10 @@ func New(cachetimeout int, enforcecachelimit bool, ch ChannelHandler, ih ItemHan
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This returns a timestamp of the last time the feed was updated.
|
||||||
|
// The value is in seconds.
|
||||||
|
func (this *Feed) LastUpdate() int64 { return this.lastupdate }
|
||||||
|
|
||||||
func (this *Feed) Fetch(uri string) (err os.Error) {
|
func (this *Feed) Fetch(uri string) (err os.Error) {
|
||||||
if !this.CanUpdate() {
|
if !this.CanUpdate() {
|
||||||
return
|
return
|
||||||
|
|
|
@ -23,16 +23,16 @@ func TestFeed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Output of handlers:
|
Output of handlers:
|
||||||
|
|
||||||
6 new item(s) in WriteTheWeb of http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml
|
6 new item(s) in WriteTheWeb of http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml
|
||||||
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml
|
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml
|
||||||
21 new item(s) in Dave Winer: Grateful Dead of http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml
|
21 new item(s) in Dave Winer: Grateful Dead of http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml
|
||||||
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml
|
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml
|
||||||
4 new item(s) in Liftoff News of http://cyber.law.harvard.edu/rss/examples/rss2sample.xml
|
4 new item(s) in Liftoff News of http://cyber.law.harvard.edu/rss/examples/rss2sample.xml
|
||||||
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/rss2sample.xml
|
1 new channel(s) in http://cyber.law.harvard.edu/rss/examples/rss2sample.xml
|
||||||
15 new item(s) in Blog@Case of http://blog.case.edu/news/feed.atom
|
15 new item(s) in Blog@Case of http://blog.case.edu/news/feed.atom
|
||||||
1 new channel(s) in http://blog.case.edu/news/feed.atom
|
1 new channel(s) in http://blog.case.edu/news/feed.atom
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue