class TZInfo::Data::TZDataTime

:nodoc:
@private
reference (:utc, :standard or :wall_clock).
A tz data time definition - a sign (1 or -1), hour, minute, second and

def initialize(spec)

def initialize(spec)
  raise "Invalid time: #{spec}" if spec !~ /^(-?)([0-9]+)(:([0-9]+)(:([0-9]+))?)?([wguzs])?$/
  @sign = $1 == '-' ? -1 : 1
  @hour = $2.to_i
  @minute = $4.nil? ? 0 : $4.to_i
  @second = $6.nil? ? 0 : $6.to_i
  if $7 == 's'
    @ref = :standard
  elsif $7 == 'g' || $7 == 'u' || $7 == 'z'
    @ref = :utc
  else
    @ref = :wall_clock
  end
end

def to_utc(utc_offset, std_offset, year, month, day)

Converts the time to UTC given a utc_offset and std_offset.
def to_utc(utc_offset, std_offset, year, month, day)
  result = if @hour > 24 || @hour == 24 && (@minute > 0 || @second > 0) || @sign != 1
    DateTime.new(year, month, day, 0, 0, 0) + Rational(@sign * (@second + (@minute + @hour * 60) * 60), 86400)
  else
    DateTime.new(year, month, day, @hour, @minute, @second)
  end
  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