Time.strftime and UTC

M

Michael C. Libby

--6WlEvdN9Dv0WHSBl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 =3D "UTC"?

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

Thanks.



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

--6WlEvdN9Dv0WHSBl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFB7eQK4ClW9KMwqnMRAjDmAJ9dT1oUzZGXpjBWBWVStGXXjlxyNACfYmWE
t5vrbFthd1xHBkug2ntfDdg=
=s5mK
-----END PGP SIGNATURE-----

--6WlEvdN9Dv0WHSBl--
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: Time.strftime and UTC"

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top