[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Time.strftime and UTC

Yukihiro Matsumoto

1/20/2005 2:36:00 AM

Hi,

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

|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.