views:

153

answers:

1

According to the Ruby docs for Time#zone:

As of Ruby 1.8, returns "UTC" rather than "GMT" for UTC times.

My OSX-using comrades see this behavior.

On my Ubuntu 9.10 system, however, Ruby 1.8.7 seems to prefer the old "GMT" terminology:

$ ruby --version
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
$ ruby -e 'puts Time.now.utc.strftime("%Z")'
GMT

Anyone have any idea why?

+1  A: 

I believe this is a bug/feature in .strftime, which more or less uses the underlying C strftime call. If you display the timezone in other ways (e.g. "puts Time.now.utc") you see "UTC".

Joe