From 57785b16b9d881e9d459064fd6223487e6c07b35 Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 12 Sep 2015 09:03:44 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ lib/net/ftp.rb | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f4baea53a..783e3b3378 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Sep 12 18:00:35 2015 Shugo Maeda + + * 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 * lib/net/ftp.rb (mlst, mlsd): support new commands MLST and MLSD diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index b70414eb2b..8bd309b21a 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -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)