class TZInfo::TZDataTime
:nodoc:
is either :utc, :standard or :wall_clock.
A tz data time definition - an hour, minute, second and reference. Reference
def initialize(spec)
def initialize(spec) raise "Invalid time: #{spec}" if spec !~ /^([0-9]+)(:([0-9]+)(:([0-9]+))?)?([wguzs])?$/ @hour = $1.to_i @minute = $3.nil? ? 0 : $3.to_i @second = $5.nil? ? 0 : $5.to_i if $6 == 's' @ref = :standard elsif $6 == 'g' || $6 == 'u' || $6 == 'z' @ref = :utc else @ref = :wall_clock end end
def to_utc(utc_offset, std_offset, year, month, day)
def to_utc(utc_offset, std_offset, year, month, day) result = DateTime.new(year, month, day, @hour, @minute, @second) offset = 0 offset = offset + utc_offset if @ref == :standard || @ref == :wall_clock offset = offset + std_offset if @ref == :wall_clock result - Rational(offset, 86400) end