Time#utc? and Time#gmt? return misleading results based on $TZ
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return
utc? is if you explicitly call
#utc on it before:
ENV['TZ'] = 'UTC' # => "UTC" time = Time.now # => 2015-10-14 19:30:00 +0000 time.utc? # => false time = time.utc # => 2015-10-14 19:30:00 UTC time.utc? # => true
This seems misleading based on the value of $TZ being "UTC". The expected result for calling
Time.now.utc? in this case would be
true, as would that be expected for time zones that are considered links to "UTC" based on the tzdata list. These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.