Project

General

Profile

Bug #1104

TZ and Time.now

Added by no6v (Nobuhiro IMAI) over 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-02-03 trunk 22015) [i686-linux]
Backport:
[ruby-dev:37896]

Description

=begin
ENV["TZ"] を変えながら Time.now の出力を見ると、以下のように何か変な感じです。

$ 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
これは正しいと思います。

$ 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
特に TZ をセットしないと、タイムゾーンが変化しません。

$ 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

何かにセットすると、一つ遅れて?変化します。
=end

History

#1

Updated by matz (Yukihiro Matsumoto) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r22053.
=end

Also available in: Atom PDF