From: Jason Creighton Date: 2003-07-24T13:10:59+09:00 Subject: Re: SMTP Date format? On Thu, 24 Jul 2003 00:32:33 +0900 Ben Giddings wrote: > While we're on the subject though, what's the recommended method for > determining your timezone offset in Ruby? ~$ ri Time This is a test 'ri'. Please report errors and omissions on http://www.rubygarden.org/ruby?RIOnePointEight ------------------------------------------------------------------------ class: Time ------------------------------------------------------------------------ Time is an abstraction of dates and times. Time is stored internally as the number of seconds and microseconds since the epoch, January 1, 1970 00:00 UTC. On some operating systems, this offset is allowed to be negative. Also see the library modules Date and ParseDate, documented beginning on pages ?? and ??, respectively. The Time class treats GMT (Greenwich Mean Time) and UTC (Coordinated Universal Time)[Yes, UTC really does stand for Coordinated Universal Time. There was a committee involved.] as equivalent. GMT is the older way of referring to these baseline times but persists in the names of calls on Posix systems. All times are stored with some number of microseconds. Be aware of this fact when comparing times with each other---times that are apparently equal when displayed may be different when compared. ------------------------------------------------------------------------ +, -, <=>, asctime, at, ctime, day, dst?, getgm, getlocal, getutc, gm, gmt?, gmt_offset, gmtime, gmtoff, hour, isdst, local, localtime, mday, min, mktime, mon, month, new, now, sec, strftime, times, to_a, to_f, to_i, to_s, tv_sec, tv_usec, usec, utc, utc, utc?, utc_offset, wday, yday, year, zone ------------------------------------------------------------------------ ~$ ri Time.gmt_offset This is a test 'ri'. Please report errors and omissions on http://www.rubygarden.org/ruby?RIOnePointEight -------------------------------------------------------- Time#gmt_offset time.gmt_offset -> aFixnum ------------------------------------------------------------------------ Returns the offset in seconds between the timezone of time and UTC. t = Time.gm(2000,1,1,20,15,1) #=> Sat Jan 01 20:15:01 UTC 2000 t.gmt_offset #=> 0 l = t.getlocal #=> Sat Jan 01 14:15:01 CST 2000 l.gmt_offset #=> -21600 Jason Creighton