diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-21 14:53:37 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-21 14:53:37 +0000 |
commit | 860caf543d42c33aa95d8c09d7eaf039142ba66a (patch) | |
tree | 3884cd7de9eb6d8dc62ec05d5c0aa2638e1160ad /data/rbot/plugins | |
parent | 8309083a1a60ba8ca7cbda5ae6b1278251dea608 (diff) |
twitter plugin: use the correct time
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/twitter.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index b29f51b4..a9ccd9c2 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -66,9 +66,10 @@ class TwitterPlugin < Plugin begin rex = REXML::Document.new(response) rex.root.elements.each("status") { |st| - month, day, hour, min, sec, year = st.elements['created_at'].text.match(/\w+ (\w+) (\d+) (\d+):(\d+):(\d+) \S+ (\d+)/)[1..6] - debug [year, month, day, hour, min, sec].inspect - time = Time.local(year.to_i, month, day.to_i, hour.to_i, min.to_i, sec.to_i) + # month, day, hour, min, sec, year = st.elements['created_at'].text.match(/\w+ (\w+) (\d+) (\d+):(\d+):(\d+) \S+ (\d+)/)[1..6] + # debug [year, month, day, hour, min, sec].inspect + # time = Time.local(year.to_i, month, day.to_i, hour.to_i, min.to_i, sec.to_i) + time = Time.parse(st.elements['created_at'].text) now = Time.now delta = now - time msg = st.elements['text'].to_s + " (#{Utils.secs_to_string(delta.to_i)} ago via #{st.elements['source'].to_s})" |