Time.strftime and UTC

Discussion in 'Ruby' started by Michael C. Libby, Jan 19, 2005.

  1. --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--
     
    Michael C. Libby, Jan 19, 2005
    #1
    1. Advertising

  2. Hi,

    In message "Re: Time.strftime and UTC"
    on Wed, 19 Jan 2005 12:45:13 +0900, "Michael C. Libby" <> 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.
     
    Yukihiro Matsumoto, Jan 20, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?aGVuaw==?=

    Covert UTC String to UTC Datetime

    =?Utf-8?B?aGVuaw==?=, May 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    18,746
    Egbert Nierop \(MVP for IIS\)
    May 7, 2006
  2. Mike Conmackie
    Replies:
    2
    Views:
    1,527
    Michael Wojcik
    Oct 13, 2004
  3. Replies:
    1
    Views:
    805
    Paul Boddie
    Mar 11, 2007
  4. deepak
    Replies:
    1
    Views:
    30,599
    Kevin Spencer
    Feb 6, 2008
  5. Greg Krohn
    Replies:
    1
    Views:
    952
    Denis Kasak
    Feb 17, 2009
Loading...

Share This Page