[Bug #1104] TZ and Time.now


#1

Bug #1104: TZ and Time.now
http://redmine.ruby-lang.org/issues/show/1104

e$B5/I<<Te(B: Nobuhiro IMAI
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-02-03 trunk 22015) [i686-linux]

ENV[“TZ”] e$B$rJQ$($J$,$ie(B Time.now
e$B$N=PNO$r8+$k$H!"0J2<$N$h$&$K2?$+JQ$J46$8$G$9!#e(B

$ echo $TZ

$ cat tz.rb
p Time.now
puts(ENV[“TZ”] = “EST”)
p Time.now
p Time.now
puts(ENV[“TZ”] = “Asia/Tokyo”)
p Time.now
p Time.now
$ ruby -v tz.rb
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Wed Feb 04 15:35:01 +0900 2009
EST
Wed Feb 04 01:35:01 -0500 2009
Wed Feb 04 01:35:01 -0500 2009
Asia/Tokyo
Wed Feb 04 15:35:01 +0900 2009
Wed Feb 04 15:35:01 +0900 2009
e$B$3$l$O@5$7$$$H;W$$$^$9!#e(B

$ ruby1.9 -v tz.rb
ruby 1.9.2dev (2009-02-03 trunk 22015) [i686-linux]
2009-02-04 15:35:14 +0900
EST
2009-02-04 15:35:14 +0900
2009-02-04 15:35:14 +0900
Asia/Tokyo
2009-02-04 15:35:14 +0900
2009-02-04 15:35:14 +0900
e$BFC$Ke(B TZ e$B$r%;%C%H$7$J$$$H!"%?%$%`%>!<%s$,JQ2=$7$^$;$s!#e(B

$ env TZ= ruby1.9 -v tz.rb
ruby 1.9.2dev (2009-02-03 trunk 22015) [i686-linux]
2009-02-04 06:35:37 +0000
EST
2009-02-04 06:35:37 +0000
2009-02-04 01:35:37 -0500
Asia/Tokyo
2009-02-04 01:35:37 -0500
2009-02-04 15:35:37 +0900

e$B2?$+$K%;%C%H$9$k$H!"0l$DCY$l$Fe(B?e$BJQ2=$7$^$9!#e(B


#2

e$B%A%1%C%He(B #1104 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r22053.

http://redmine.ruby-lang.org/issues/show/1104