https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112015-11-30T13:24:38ZRuby Issue Tracking SystemRuby master - Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZhttps://bugs.ruby-lang.org/issues/11595?journal_id=551652015-11-30T13:24:38Znkmrya (Yasuhiro Nakamura)yasuhiro6194@gmail.com
<ul><li><strong>Assignee</strong> set to <i>akr (Akira Tanaka)</i></li></ul> Ruby master - Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZhttps://bugs.ruby-lang.org/issues/11595?journal_id=551662015-11-30T13:27:48Znkmrya (Yasuhiro Nakamura)yasuhiro6194@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/5606">time_utc.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/5606/time_utc.patch">time_utc.patch</a> added</li></ul><p>Anyway I write a patch.</p>
<p>Is it a bug? or specification?</p> Ruby master - Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZhttps://bugs.ruby-lang.org/issues/11595?journal_id=551692015-11-30T16:55:45Zdavidcelis (David Celis)me@davidcel.is
<ul></ul><p>Yasuhiro Nakamura wrote:</p>
<blockquote>
<p>Anyway I write a patch.</p>
<p>Is it a bug? or specification?</p>
</blockquote>
<p>To me it seems like a bug, since the expectation is that Time#utc? would return true for any time with an offset of 0</p> Ruby master - Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZhttps://bugs.ruby-lang.org/issues/11595?journal_id=565492016-01-23T18:55:15Zavit (Andrew Vit)andrew@avit.ca
<ul></ul><p>Careful: not every time with offset 0 is UTC.</p>
<p>A time zone with offset +0100/-0100 may have DST rules, and should not be <code>utc?</code>.</p> Ruby master - Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZhttps://bugs.ruby-lang.org/issues/11595?journal_id=613272016-11-05T16:09:03Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>Current behavior is intentional.</p>
<p>Time#utc? returns the mode of Time object, not the time zone offset is zero.</p>
<p>The mode affects several methods.</p>
<p>For example, Time#to_s generates "UTC" for UTC Time objects and<br>
numeric timezone offset string for non-UTC Time objects.<br>
The result of Time#utc? method means the difference of them.</p>
<pre><code>% TZ=GMT ruby -e '
u = Time.utc(2000)
l = Time.local(2000)
p [u, u.utc?]
p [l, l.utc?]'
[2000-01-01 00:00:00 UTC, true]
[2000-01-01 00:00:00 +0000, false]
</code></pre>