1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-11-25 06:26:26 +00:00
parent 913ed016c1
commit f20f84d60a
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Tue Nov 25 15:26:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <nobu@ruby-lang.org> Tue Nov 25 12:14:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (Init_process): initialize static IDs before constant * process.c (Init_process): initialize static IDs before constant

View file

@ -62,7 +62,11 @@ class VCS
if modified if modified
/\A(\d+)-(\d+)-(\d+)\D(\d+):(\d+):(\d+(?:\.\d+)?)\s*(?:Z|([-+]\d\d)(\d\d))\z/ =~ modified or /\A(\d+)-(\d+)-(\d+)\D(\d+):(\d+):(\d+(?:\.\d+)?)\s*(?:Z|([-+]\d\d)(\d\d))\z/ =~ modified or
raise "unknown time format - #{modified}" 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 end
return last, changed, modified, *rest return last, changed, modified, *rest
end end