diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-25 06:26:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-25 06:26:26 +0000 |
commit | f20f84d60a467c1bc8a0ca81fe2788fa4c8079f8 (patch) | |
tree | aa2b5b381fe71da86f15d2fa812f52436c4baef5 | |
parent | 913ed016c1efa45afd78c6c56484bbdd0fde9454 (diff) |
vcs.rb: make Time with proper offset
* tool/vcs.rb (get_revisions): use Time.new instead of Time.mktime
which does not accept UTC offset, and offset manually for older
versions than 1.9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | tool/vcs.rb | 6 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Tue Nov 25 15:26:33 2014 Nobuyoshi Nakada <[email protected]> + + * tool/vcs.rb (get_revisions): use Time.new instead of Time.mktime + which does not accept UTC offset, and offset manually for older + versions than 1.9. + Tue Nov 25 12:14:43 2014 Nobuyoshi Nakada <[email protected]> * process.c (Init_process): initialize static IDs before constant diff --git a/tool/vcs.rb b/tool/vcs.rb index b3f3a31642..49c70648fd 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -62,7 +62,11 @@ class VCS if modified /\A(\d+)-(\d+)-(\d+)\D(\d+):(\d+):(\d+(?:\.\d+)?)\s*(?:Z|([-+]\d\d)(\d\d))\z/ =~ modified or raise "unknown time format - #{modified}" - modified = Time.mktime(*($~[1..6] + [$7 ? "#{$7}:#{$8}" : "+00:00"])) + begin + modified = Time.new(*$~[1..6].map(&:to_i), ($7 ? "#{$7}:#{$8}" : "+00:00")) + rescue ArgumentError + modified = Time.utc(*$~[1..6]) + $7.to_i * 3600 + $8.to_i * 60 + end end return last, changed, modified, *rest end |