lib/et-orbi/zones.rb
# Semi-helpful, since it requires the current time
#
Semi-helpful, since it requires the current time
Semi - helpful since it requires the current time
def windows_zone_name(zone_name, time)
      twin = Time.utc(time.year, 1, 1) 
      tsum = Time.utc(time.year, 7, 1) 
      tz = ::TZInfo::Timezone.get(zone_name)
      tzo = tz.period_for_local(time).utc_total_offset
      tzop = tzo < 0 ? nil : '-'; tzo = tzo.abs
      tzoh = tzo / 3600
      tzos = tzo % 3600
      tzos = tzos == 0 ? nil : ':%02d' % (tzos / 60)
      abbs = [
        tz.period_for_utc(twin).abbreviation.to_s,
        tz.period_for_utc(tsum).abbreviation.to_s ]
          .uniq
      if abbs[0].match(/\A[A-Z]/)
        [ abbs[0], tzop, tzoh, tzos, abbs[1] ]
          .compact.join
      else
        [ windows_zone_code_x(zone_name), tzop, tzoh, tzos || ':00', zone_name ]
          .collect(&:to_s).join
      end
    end
def windows_zone_name ( zone_name , time ) twin = Time . utc ( time . year , 1 , 1 ) tsum = Time . utc ( time . year , 7 , 1 ) tz = :: TZInfo :: Timezone . get ( zone_name ) tzo = tz . period_for_local ( time ) . utc_total_offset tzop = tzo < 0 ? nil : '-' ; tzo = tzo . abs tzoh = tzo / 3600 tzos = tzo % 3600 tzos = tzos == 0 ? nil : ':%02d' % ( tzos / 60 ) abbs = [ tz . period_for_utc ( twin ) . abbreviation . to_s , tz . period_for_utc ( tsum ) . abbreviation . to_s ] . uniq if abbs [ 0 ] . match ( / \A [A-Z] / ) [ abbs [ 0 ] , tzop , tzoh , tzos , abbs [ 1 ] ] . compact . join else [ windows_zone_code_x ( zone_name ) , tzop , tzoh , tzos || ':00' , zone_name ] . collect ( & :to_s ) . join end end
Semi-helpful, since it requires the current time
Semi - helpful since it requires the current time
# winter # summer
zone_name
<not_specific>
time
<not_specific>