mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix capture to avoid doing a sub on the useconds when parsing dates
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f5b0f04d2a
commit
d3802d719c
1 changed files with 2 additions and 2 deletions
|
@ -80,10 +80,10 @@ module Psych
|
|||
def parse_time string
|
||||
date, time = *(string.split(/[ tT]/, 2))
|
||||
(yy, m, dd) = date.split('-').map { |x| x.to_i }
|
||||
md = time.match(/(\d+:\d+:\d+)(\.\d*)?\s*(Z|[-+]\d+(:\d\d)?)?/)
|
||||
md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/)
|
||||
|
||||
(hh, mm, ss) = md[1].split(':').map { |x| x.to_i }
|
||||
us = (md[2] ? Rational(md[2].sub(/^\./, '0.')) : 0) * 1000000
|
||||
us = (md[2] ? Rational("0.#{md[2]}") : 0) * 1000000
|
||||
|
||||
time = Time.utc(yy, m, dd, hh, mm, ss, us)
|
||||
|
||||
|
|
Loading…
Reference in a new issue