* lib/net/ftp.rb (TIME_PARSER): use "Z" instead of "00:00" to

get UTC time.  Thanks, Wilson Bilkovich.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2015-09-12 09:03:44 +00:00
Родитель 8b3d351f83
Коммит 57785b16b9
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sat Sep 12 18:00:35 2015 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (TIME_PARSER): use "Z" instead of "+00:00" to
get UTC time. Thanks, Wilson Bilkovich.
Sat Sep 12 17:55:24 2015 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (mlst, mlsd): support new commands MLST and MLSD

Просмотреть файл

@ -774,8 +774,7 @@ module Net
CASE_INDEPENDENT_PARSER = ->(value) { value.downcase }
INTEGER_PARSER = ->(value) { value.to_i }
TIME_PARSER = ->(value) {
t = Time.strptime(value.sub(/\.\d+\z/, "") + "+00:00",
"%Y%m%d%H%M%S%z").utc
t = Time.strptime(value.sub(/\.\d+\z/, "") + "Z", "%Y%m%d%H%M%S%z")
fractions = value.slice(/\.(\d+)\z/, 1)
if fractions
t + fractions.to_i.quo(10 ** fractions.size)