Created
August 20, 2009 01:34
-
-
Save edavis10/170761 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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