"GMT" instead of "UTC" in Ruby 1.8

According to the Ruby docs for Time#zone :

As of Ruby 1.8, UTC is returned, not "GMT" for UTC.

My OSX compatible mates 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 

Does anyone know why?

+4
source share
1 answer

I believe this is a bug / function in .strftime that more or less uses the base call to C strftime. If you show the time zone in other ways (for example, "puts Time.now.utc"), you see "UTC".

+3
source

Source: https://habr.com/ru/post/1302752/


All Articles