https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112012-06-28T09:53:13ZRuby Issue Tracking SystemBackport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=275332012-06-28T09:53:13Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>2012/6/27 stomar (Marcus Stollsteimer) <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a>:</p>
<blockquote>
<p>Issue <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Time#strftime('%Z') should return 'UTC' instead of 'GMT' (Closed)" href="https://redmine.ruby-lang.org/issues/6656">#6656</a> has been reported by stomar (Marcus Stollsteimer).</p>
</blockquote>
<blockquote>
<p>Time#strftime('%Z') should return 'UTC' instead of 'GMT',<br>
as in Time#to_s and Time#zone. This is also the behaviour of Ruby 1.9.3.</p>
<p>irb(main):001:0> Time.utc(2012, 6, 27).to_s<br>
=> "Wed Jun 27 00:00:00 UTC 2012"<br>
irb(main):002:0> Time.utc(2012, 6, 27).zone<br>
=> "UTC"<br>
irb(main):003:0> Time.utc(2012, 6, 27).strftime('%Z')<br>
=> "GMT"</p>
</blockquote>
<p>Ruby 1.8 uses strftime() in libc.</p>
<p>Ruby 1.9 uses own strftime() which %Z should produce UTC.</p>
<p>% ruby-1.8.7p357 -ve 'p Time.utc(2012, 6, 27).strftime("%Z")'<br>
ruby 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux]<br>
"GMT"<br>
% ruby-1.9.3p194 -ve 'p Time.utc(2012, 6, 27).strftime("%Z")'<br>
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]<br>
"UTC"</p>
<a name="Do-you-really-sure-that-it-returns-GMT-with-Ruby-193"></a>
<h2 >Do you really sure that it returns "GMT" with Ruby 1.9.3?<a href="#Do-you-really-sure-that-it-returns-GMT-with-Ruby-193" class="wiki-anchor">¶</a></h2>
<p>Tanaka Akira</p> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=275442012-06-28T17:23:19Zstomar (Marcus Stollsteimer)
<ul></ul><p>Am 28.06.2012 02:29, schrieb Tanaka Akira:</p>
<blockquote>
<p>2012/6/27 stomar (Marcus Stollsteimer) <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a>:</p>
<blockquote>
<p>Issue <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Time#strftime('%Z') should return 'UTC' instead of 'GMT' (Closed)" href="https://redmine.ruby-lang.org/issues/6656">#6656</a> has been reported by stomar (Marcus Stollsteimer).</p>
</blockquote>
<blockquote>
<p>Time#strftime('%Z') should return 'UTC' instead of 'GMT',<br>
as in Time#to_s and Time#zone. This is also the behaviour of Ruby 1.9.3.</p>
<p>irb(main):001:0> Time.utc(2012, 6, 27).to_s<br>
=> "Wed Jun 27 00:00:00 UTC 2012"<br>
irb(main):002:0> Time.utc(2012, 6, 27).zone<br>
=> "UTC"<br>
irb(main):003:0> Time.utc(2012, 6, 27).strftime('%Z')<br>
=> "GMT"</p>
</blockquote>
<p>Ruby 1.8 uses strftime() in libc.</p>
<p>Ruby 1.9 uses own strftime() which %Z should produce UTC.</p>
<p>% ruby-1.8.7p357 -ve 'p Time.utc(2012, 6, 27).strftime("%Z")'<br>
ruby 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux]<br>
"GMT"<br>
% ruby-1.9.3p194 -ve 'p Time.utc(2012, 6, 27).strftime("%Z")'<br>
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]<br>
"UTC"</p>
<p>Do you really sure that it returns "GMT" with Ruby 1.9.3?</p>
</blockquote>
<p>Sorry, what I meant is:</p>
<p>The desired behavior would be that "UTC" is used <em>consistently</em><br>
in all 3 methods, as is already the case in Ruby 1.9.3.</p>
<p>At the moment, strftime('%Z') behaves differently in versions 1.8.7<br>
and 1.9.3 and additionally even behaves in an unexpected and<br>
most inconsistent way within 1.8.7: #strftime('%Z') and #zone<br>
should output the same time zone name.</p>
<p>rdoc for Time#zone (1.8.7):</p>
<pre><code>Returns the name of the time zone used for time.
As of Ruby 1.8, returns “UTC” rather than “GMT” for UTC times.
</code></pre>
<p>rdoc for strftime with '%Z' (1.8.7):</p>
<pre><code>%Z - Time zone name
</code></pre>
<p>Marcus</p>
<p>--<br>
<a href="https://github.com/stomar/" class="external">https://github.com/stomar/</a></p> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=275492012-06-28T22:23:18Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>2012/6/28 Marcus Stollsteimer <a href="mailto:sto.mar@web.de" class="email">sto.mar@web.de</a>:</p>
<blockquote>
<p>The desired behavior would be that "UTC" is used <em>consistently</em><br>
in all 3 methods, as is already the case in Ruby 1.9.3.</p>
</blockquote>
<p>I see. I misunderstood.</p>
<p>However Ruby 1.8's %Z behavior is intended behavior because<br>
Ruby 1.8 uses just a strftime() in libc.</p>
<h2>So, this issue is a new feature request.<br>
I guess it is difficult to implement, discuss and accept for Ruby 1.8.7<br>
until the next (and last) Ruby 1.8.7 release.</h2>
<p>Tanaka Akira</p> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=275502012-06-29T01:53:27Zstomar (Marcus Stollsteimer)
<ul></ul><p>Am 28.06.2012 15:08, schrieb Tanaka Akira:</p>
<blockquote>
<p>However Ruby 1.8's %Z behavior is intended behavior because<br>
Ruby 1.8 uses just a strftime() in libc.<br>
So, this issue is a new feature request.</p>
</blockquote>
<p>I disagree.</p>
<p>A programmer should not have to worry about the implementation of<br>
the method. Furthermore, in the documentation #strftime is not marked<br>
as a mere wrapper for the C library's strftime().</p>
<p>The different behavior of strftime('%Z') and #zone / #to_s<br>
is unexpected and seems even contradictory to the statement<br>
in the #zone documentation, that "UTC" is used since 1.8.</p>
<p>Regards,<br>
Marcus</p>
<p>--<br>
<a href="https://github.com/stomar/" class="external">https://github.com/stomar/</a></p> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=275542012-06-29T06:53:55Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>2012/6/29 <a href="mailto:sto.mar@web.de" class="email">sto.mar@web.de</a>:</p>
<blockquote>
<p>A programmer should not have to worry about the implementation of<br>
the method. Furthermore, in the documentation #strftime is not marked<br>
as a mere wrapper for the C library's strftime().</p>
</blockquote>
<a name="Hm-It-may-be-possible-to-consider-it-a-documentation-bug"></a>
<h2 >Hm. It may be possible to consider it a documentation bug.<a href="#Hm-It-may-be-possible-to-consider-it-a-documentation-bug" class="wiki-anchor">¶</a></h2>
<p>Tanaka Akira</p> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=280892012-07-14T18:36:46Zayumin (Ayumu AIZAWA)ayumu.aizawa@gmail.com
<ul><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Ruby 1.8</i></li></ul> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=794482019-07-15T14:28:54Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby 1.8</i> to <i>Backport186</i></li><li><strong>ruby -v</strong> deleted (<del><i>ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]</i></del>)</li></ul> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=794502019-07-15T14:34:27Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Tracker</strong> changed from <i>Backport</i> to <i>Bug</i></li><li><strong>Project</strong> changed from <i>Backport186</i> to <i>Ruby master</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>Backport</strong> set to <i>2.5: UNKNOWN, 2.6: UNKNOWN</i></li></ul> Backport187 - Backport #6656: Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://redmine.ruby-lang.org/issues/6656?journal_id=794512019-07-15T14:35:41Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport187</i></li><li><strong>Backport</strong> deleted (<del><i>2.5: UNKNOWN, 2.6: UNKNOWN</i></del>)</li></ul>