https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112019-05-28T15:37:38ZRuby Issue Tracking SystemRuby master - Bug #15884: Time module fails to identify timezone correctlyhttps://bugs.ruby-lang.org/issues/15884?journal_id=782572019-05-28T15:37:38Zwishdev (John Higgins)wishdev@gmail.com
<ul></ul><p>I think this shows the logic behind what is occurring here.</p>
<p>On my system</p>
<p>Time.new(2002, 12, 1).zone<br>
=> PST<br>
(Time.new(2002, 12, 1) + 60 * 60 * 24 * 180).zone # Add 180 days<br>
=> PDT</p>
<p>Time.new(2002, 12, 1).utc.zone<br>
=> UTC<br>
(Time.new(2002, 12, 1).utc + 60 * 60 * 24 * 180).zone # Add 180 days<br>
=> UTC</p>
<p>The difference is that Time.new returns a local time zone stamped time - which is subject to change at the whim of the local authority. When you use either Time.utc or Time.new.utc you end up with a locked UTC time which will not change based on what day of the year it is.</p>
<p>So that Dec 1st, 2012 may have fallen into the UTC time zone on your local system - it does not mean that it is a UTC time - it is a UTC at the exact moment you checked but subject to change.</p>
<p>I believe that the current behavior is much better because it ensures you are using an exact concept as opposed to something that is time of year/locality dependent. If you want UTC time - then ensure you have UTC time with either Time.utc or friends.</p> Ruby master - Bug #15884: Time module fails to identify timezone correctlyhttps://bugs.ruby-lang.org/issues/15884?journal_id=782662019-05-30T12:16:43ZAnonymous
<ul></ul><p>Thanks for such a good explanation John! What you said makes perfect sense so I'm happy to close this as "invalid", or whatever is the most appropriate status. Unfortunately, I don't seem to be able to update the Status on this ticket.</p> Ruby master - Bug #15884: Time module fails to identify timezone correctlyhttps://bugs.ruby-lang.org/issues/15884?journal_id=782672019-05-30T14:13:27Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul>