[TZInfo-users] timezones, periods and utc_offset

Philip Ross phil.ross at gmail.com
Sun Jan 7 19:00:48 EST 2007


On 07/01/07, Nicola Piccinini <pic at superfluo.org> wrote:
> sorry for the silly question:
> is the result of
> tz.current_period.offset.utc_offset
> constant over time?
> In other words: is it independent from the current period? (as I suppose)

I don't think its a silly question - the documentation could do with
some improvements.

utc_offset is the base offset from UTC.  For example, Europe/Rome is
at UTC + 1 hour and America/New_York is at UTC - 5 hours.  std_offset
is the offset to the usually observed time as given by utc_offset.  It
will typically vary between 0 and +1 hour according to daylight
savings. utc_total_offset is utc_offset + std_offset.

utc_offset tends to stay constant over time.  It won't necessarily
remain the same across all periods though because countries sometimes
redefine their timezones.

It's also worth noting that you should be using
tz.current_period.utc_offset rather than
tz.current_period.offset.utc_offset. start_transition, end_transition
and offset shouldn't really be publicly available and may be removed
in a future release.

-- 
Phil Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby


More information about the TZInfo-users mailing list