Time.strftime and UTC

Hi, just wondering if I'm missing something...

mcl@saluki:~$ ruby -v
ruby 1.8.2 (2004-11-06) [i686-linux]
mcl@saluki:~$ ruby -e 'puts Time.new.utc.strftime("%H:%M %Z")'
04:31 GMT

If I say to convert to UTC, shouldn't I get %Z = "UTC"?

It also contradicts page 649 of Pickaxe2 which says that 1.8+
would have UTC instead of GMT anyway.

Thanks.

···

--
( Michael C. Libby | www.andsoforth.com | 2005-01-19 04:31 UTC )

Hi,

mcl@saluki:~$ ruby -e 'puts Time.new.utc.strftime("%H:%M %Z")'
04:31 GMT

If I say to convert to UTC, shouldn't I get %Z = "UTC"?

It also contradicts page 649 of Pickaxe2 which says that 1.8+
would have UTC instead of GMT anyway.

Unlike inspect or to_s, strftime honors underlying strftime(3)
function on the platform. This means strftime(3) function on your
platform returns GMT for %Z for time on UTC zone. I'm not sure this
situation could be fixed, since it requires either

  * abandon strftime(3) and re-implement the whole time formatting
    function.

  * or seek for the format string and replace %Z to UTC if a time is
    in the UTC zone.

which cost us much anyway.

              matz.

···

In message "Re: Time.strftime and UTC" on Wed, 19 Jan 2005 12:45:13 +0900, "Michael C. Libby" <mcl@andsoforth.com> writes: