function t = getBusTime(rootBus, pathStr)
%GETBUSTIME Estrae il vettore tempo da un segnale dentro un bus gerarchico.

    node = getBusNode(rootBus, pathStr);

    if isa(node, 'Simulink.SimulationData.Signal')
        node = node.Values;
    end

    if isa(node, 'timeseries')
        t = node.Time;
    elseif isstruct(node) && isfield(node, 'Time')
        t = node.Time;
    else
        error('getBusTime:unsupportedType', ...
            'Impossibile estrarre Time dal path "%s". Tipo: %s', ...
            pathStr, class(node));
    end

    t = t(:);
end