Skip to content

Instantly share code, notes, and snippets.

@edavis10
Created August 20, 2009 01:34
Show Gist options
  • Save edavis10/170761 to your computer and use it in GitHub Desktop.
Save edavis10/170761 to your computer and use it in GitHub Desktop.
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
>> cmd = "puts Time.local(2009).zone"
=> "puts Time.local(2009).zone"
>> ['PST', 'CST'].each do |tz|
?> ENV['TZ'] = tz
?> puts `ruby -e \"#{cmd}\"` # Prints two different values on Windows
?> end
UTC
UTC
=> ["PST", "CST"]
>> ['PST', 'CST'].each do |tz|
?> ENV['TZ'] = tz
?> eval(cmd) # Prints the same value on Windows since changing ENV[‘TZ’] on the fly does not work
?> end
UTC
UTC
=> ["PST", "CST"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment