Bug #8885
closedIncorrect time is created for time including leap seconds
Description
Updated by no6v (Nobuhiro IMAI) almost 13 years ago
=begin
Which is your timezone? I guess it works correctly.
RUBY_DESCRIPTION # => "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]"
ENV["TZ"] = "UTC"
Time.new(2012, 6, 30, 23, 59, 60) # => 2012-07-01 00:00:00 +0000
ENV["TZ"] = "right/UTC"
Time.new(2012, 6, 30, 23, 59, 60) # => 2012-06-30 23:59:60 +0000
ENV["TZ"] = "Japan"
Time.new(2012, 6, 30, 23, 59, 60) # => 2012-07-01 00:00:00 +0900
Time.new(2012, 7, 1, 8, 59, 60) # => 2012-07-01 09:00:00 +0900
ENV["TZ"] = "right/Japan"
Time.new(2012, 6, 30, 23, 59, 60) # => 2012-07-01 00:00:00 +0900
Time.new(2012, 7, 1, 8, 59, 60) # => 2012-07-01 08:59:60 +0900
=end
Updated by akr (Akira Tanaka) almost 13 years ago
2013/9/10 sawa (Tsuyoshi Sawada) sawadatsuyoshi@gmail.com:
Bug #8885: Incorrect time is created for time including leap seconds
https://bugs.ruby-lang.org/issues/8885
ruby -v: 2.0
Time.newcreates incorrect time when the time includes a leap second.
At first, please confirm your enviroment (OS and configuration)
supports leap seconds.
Ruby supports leap seconds only if your environment supports leap seconds.
What is your OS?
The command line, ruby -v, shows the ruby version including your OS.
But you didn't fill the entry of the form as the result of the command line.
("2.0" is not a proper result of ruby -v.)
Example:
% ruby -v
ruby 2.1.0dev (2013-08-16 trunk 42586) [x86_64-linux]
What is the value of TZ environment variable?
Some (Unix) environment sees TZ environment variable to determine to
support leap seconds or not.
(The value prefixed with "right/" may indicate leap seconds support.)
What the result of the following command?
% ruby -e '3.times {|i| p Time.at(78796799+i) }'
The command shows Time class behavior around the first leap second,
1972-06-30T23:59:60Z.
Environment which supports leap seconds:
% TZ=right/UTC ruby -e '3.times {|i| p Time.at(78796799+i) }'
1972-06-30 23:59:59 +0000
1972-06-30 23:59:60 +0000
1972-07-01 00:00:00 +0000
Environment which doesn't support leap seconds:
% TZ=UTC ruby -e '3.times {|i| p Time.at(78796799+i) }'
1972-06-30 23:59:59 +0000
1972-07-01 00:00:00 +0000
1972-07-01 00:00:01 +0000¶
Tanaka Akira
Updated by sawa (Tsuyoshi Sawada) almost 13 years ago
The Ruby version is ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]. I didn't have the timezone set to one that supports leap second. Once I attached "right/", it worked. Thank you for the help. I would like to withdraw this issue.
Updated by znz (Kazuhiro NISHIYAMA) almost 13 years ago
- Status changed from Open to Rejected