public
Description: rFeedParser is a translation of the Universal Feed Parser from Python into Ruby. It has nearly the exact same behavior.
Homepage: http://rfeedparser.rubyforge.org
Clone URL: git://github.com/jmhodges/rfeedparser.git
Search Repo:
handling w3dtf timestamp having fractions of a second in it
jmhodges (author)
Thu Jul 24 18:12:08 -0700 2008
commit  d41a35b03e030bd6c66c41e87d3e23806f1722d1
tree    e76375b4527511a9d8076d030be119a2df5b5680
parent  78bf5ee5827d433f4939a0768b8342d2cf48bc0c
...
277
278
279
 
280
281
282
283
284
285
286
287
 
288
289
290
...
277
278
279
280
281
 
282
283
284
285
286
 
287
288
289
290
0
@@ -277,14 +277,14 @@ module FeedParser
0
         end
0
         return r
0
       end
0
+
0
       # W3DTF-style date parsing
0
- # FIXME shouldn't it be "W3CDTF"?
0
       def parse_date_w3dtf(dateString)
0
         # Ruby's Time docs claim w3cdtf is an alias for iso8601 which is an alias for xmlschema
0
         # Whatever it is, it doesn't work. This has been fixed in Ruby 1.9 and
0
         # in Ruby on Rails, but not really. They don't fix the 25 hour or 61 minute or 61 second rollover and fail in other ways.
0
 
0
- m = dateString.match(/^(\d{4})-?(?:(?:([01]\d)-?(?:([0123]\d)(?:T(\d\d):(\d\d):(\d\d)([+-]\d\d:\d\d|Z))?)?)?)?/)
0
+ m = dateString.match(/^(\d{4})-?(?:(?:([01]\d)-?(?:([0123]\d)(?:T(\d\d):(\d\d):(\d\d)(?:\.(\d+)?)([+-]\d\d:\d\d|Z))?)?)?)?/)
0
 
0
         w3 = m[1..3].map{|s| s=s.to_i; s += 1 if s == 0;s} # Map the year, month and day to integers and, if they were nil, set them to 1
0
         w3 += m[4..6].map{|s| s.to_i}       # Map the hour, minute and second to integers

Comments

    No one has commented yet.