Horde_Mapi_Timezone::_generateOffsetsForTransition PHP Method

_generateOffsetsForTransition() protected static method

Calculate the offsets for the specified transition
protected static _generateOffsetsForTransition ( array $offsets, array $transition, string $type ) : array
$offsets array A TZ offset hash
$transition array A transition hash
$type string Transition type - dst or std
return array A populated offset hash
    protected static function _generateOffsetsForTransition(array $offsets, array $transition, $type)
    {
        // We can't use Horde_Date directly here, since it is unable to
        // properly convert to UTC from local ON the exact hour of a std -> dst
        // transition. This is due to a conversion to DateTime in the localtime
        // zone internally before the timezone change is applied
        $transitionDate = new DateTime($transition['time']);
        $transitionDate->setTimezone(new DateTimeZone('UTC'));
        $transitionDate = new Horde_Date($transitionDate);
        $offsets[$type . 'month'] = $transitionDate->format('n');
        $offsets[$type . 'day'] = $transitionDate->format('w');
        $offsets[$type . 'minute'] = (int) $transitionDate->format('i');
        $offsets[$type . 'hour'] = (int) $transitionDate->format('H');
        for ($i = 5; $i > 0; $i--) {
            if (self::_isNthOcurrenceOfWeekdayInMonth($transition['ts'], $i)) {
                $offsets[$type . 'week'] = $i;
                break;
            }
        }
        return $offsets;
    }