From: Tanaka Akira Date: 2011-01-05T13:39:21+09:00 Subject: Re: Time + time.local 2011-01-04 15:45 d c : > > I cant seem to get localtime to work, can anyone share some gotchas? Ruby uses a C-level function, localtime(), to obtain the timezone information . localtime() uses the timezone OS provides. POSIX defines a form of TZ environment variable. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html According to this definition, JST-9 represent the timezone of Japan. % TZ=JST-9 ./ruby -ve 't = Time.now; p [t, t.zone]' ruby 1.9.3dev (2011-01-01 trunk 30441) [i686-linux] [2011-01-05 13:25:36 +0900, "JST"] If OS uses tzcode by Arthur David Olson, TZ format is extended for the location's full name. http://www.twinsun.com/tz/tz-link.htm > irb(main):009:0> t1.localtime("+09:00") > ArgumentError: wrong number of arguments (1 for 0) > from (irb):9:in `localtime' > from (irb):9 > from :0 > > ## according to docs this should work: > http://www.ruby-doc.org/core/classes/Time.html#M000346 time.localtime(utc_offset) is available since Ruby 1.9.2. -- Tanaka Akira