build/ical.js
function utcOffset(tt) {
      if (this == ICAL.Timezone.utcTimezone || this == ICAL.Timezone.localTimezone) {
        return 0;
      }

      this._ensureCoverage(tt.year);

      if (!this.changes.length) {
        return 0;
      }

      var tt_change = {
        year: tt.year,
        month: tt.month,
        day: tt.day,
        hour: tt.hour,
        minute: tt.minute,
        second: tt.second
      };

      var change_num = this._findNearbyChange(tt_change);
      var change_num_to_use = -1;
      var step = 1;

      // TODO: replace with bin search?
      for (;;) {
        var change = ICAL.helpers.clone(this.changes[change_num], true);
        if (change.utcOffset < change.prevUtcOffset) {
          ICAL.Timezone.adjust_change(change, 0, 0, 0, change.utcOffset);
        } else {
          ICAL.Timezone.adjust_change(change, 0, 0, 0,
                                          change.prevUtcOffset);
        }

        var cmp = ICAL.Timezone._compare_change_fn(tt_change, change);

        if (cmp >= 0) {
          change_num_to_use = change_num;
        } else {
          step = -1;
        }

        if (step == -1 && change_num_to_use != -1) {
          break;
        }

        change_num += step;

        if (change_num < 0) {
          return 0;
        }

        if (change_num >= this.changes.length) {
          break;
        }
      }

      var zone_change = this.changes[change_num_to_use];
      var utcOffset_change = zone_change.utcOffset - zone_change.prevUtcOffset;

      if (utcOffset_change < 0 && change_num_to_use > 0) {
        var tmp_change = ICAL.helpers.clone(zone_change, true);
        ICAL.Timezone.adjust_change(tmp_change, 0, 0, 0,
                                        tmp_change.prevUtcOffset);

        if (ICAL.Timezone._compare_change_fn(tt_change, tmp_change) < 0) {
          var prev_zone_change = this.changes[change_num_to_use - 1];

          var want_daylight = false; // TODO

          if (zone_change.is_daylight != want_daylight &&
              prev_zone_change.is_daylight == want_daylight) {
            zone_change = prev_zone_change;
          }
        }
      }

      // TODO return is_daylight?
      return zone_change.utcOffset;
    }
function utcOffset(tt) {
      if (this == ICAL.Timezone.utcTimezone || this == ICAL.Timezone.localTimezone) {
        return 0;
      }

      this._ensureCoverage(tt.year);

      if (!this.changes.length) {
        return 0;
      }

      var tt_change = {
        year: tt.year,
        month: tt.month,
        day: tt.day,
        hour: tt.hour,
        minute: tt.minute,
        second: tt.second
      };

      var change_num = this._findNearbyChange(tt_change);
      var change_num_to_use = -1;
      var step = 1;

      // TODO: replace with bin search?
      for (;;) {
        var change = ICAL.helpers.clone(this.changes[change_num], true);
        if (change.utcOffset < change.prevUtcOffset) {
          ICAL.Timezone.adjust_change(change, 0, 0, 0, change.utcOffset);
        } else {
          ICAL.Timezone.adjust_change(change, 0, 0, 0,
                                          change.prevUtcOffset);
        }

        var cmp = ICAL.Timezone._compare_change_fn(tt_change, change);

        if (cmp >= 0) {
          change_num_to_use = change_num;
        } else {
          step = -1;
        }

        if (step == -1 && change_num_to_use != -1) {
          break;
        }

        change_num += step;

        if (change_num < 0) {
          return 0;
        }

        if (change_num >= this.changes.length) {
          break;
        }
      }

      var zone_change = this.changes[change_num_to_use];
      var utcOffset_change = zone_change.utcOffset - zone_change.prevUtcOffset;

      if (utcOffset_change < 0 && change_num_to_use > 0) {
        var tmp_change = ICAL.helpers.clone(zone_change, true);
        ICAL.Timezone.adjust_change(tmp_change, 0, 0, 0,
                                        tmp_change.prevUtcOffset);

        if (ICAL.Timezone._compare_change_fn(tt_change, tmp_change) < 0) {
          var prev_zone_change = this.changes[change_num_to_use - 1];

          var want_daylight = false; // TODO

          if (zone_change.is_daylight != want_daylight &&
              prev_zone_change.is_daylight == want_daylight) {
            zone_change = prev_zone_change;
          }
        }
      }

      // TODO return is_daylight?
      return zone_change.utcOffset;
    }
function utcOffset ( tt ) { if ( this == ICAL . Timezone . utcTimezone || this == ICAL . Timezone . localTimezone ) { return 0 ; } this . _ensureCoverage ( tt . year ) ; if ( ! this . changes . length ) { return 0 ; } var tt_change = { year : tt . year , month : tt . month , day : tt . day , hour : tt . hour , minute : tt . minute , second : tt . second } ; var change_num = this . _findNearbyChange ( tt_change ) ; var change_num_to_use = - 1 ; var step = 1 ; // TODO: replace with bin search? for ( ; ; ) { var change = ICAL . helpers . clone ( this . changes [ change_num ] , true ) ; if ( change . utcOffset < change . prevUtcOffset ) { ICAL . Timezone . adjust_change ( change , 0 , 0 , 0 , change . utcOffset ) ; } else { ICAL . Timezone . adjust_change ( change , 0 , 0 , 0 , change . prevUtcOffset ) ; } var cmp = ICAL . Timezone . _compare_change_fn ( tt_change , change ) ; if ( cmp >= 0 ) { change_num_to_use = change_num ; } else { step = - 1 ; } if ( step == - 1 && change_num_to_use != - 1 ) { break ; } change_num += step ; if ( change_num < 0 ) { return 0 ; } if ( change_num >= this . changes . length ) { break ; } } var zone_change = this . changes [ change_num_to_use ] ; var utcOffset_change = zone_change . utcOffset - zone_change . prevUtcOffset ; if ( utcOffset_change < 0 && change_num_to_use > 0 ) { var tmp_change = ICAL . helpers . clone ( zone_change , true ) ; ICAL . Timezone . adjust_change ( tmp_change , 0 , 0 , 0 , tmp_change . prevUtcOffset ) ; if ( ICAL . Timezone . _compare_change_fn ( tt_change , tmp_change ) < 0 ) { var prev_zone_change = this . changes [ change_num_to_use - 1 ] ; var want_daylight = false ; // TODO if ( zone_change . is_daylight != want_daylight && prev_zone_change . is_daylight == want_daylight ) { zone_change = prev_zone_change ; } } } // TODO return is_daylight? return zone_change . utcOffset ; }
Finds the utcOffset the given time would occur in this timezone.

@param {ICAL.Time} tt        The time to check for
@return {Number} utc offset in seconds
Finds the utcOffset the given time would occur in this timezone .