function t = myrange2ttrend(THIS,range)
% MYRANGE2TTREND  [Not a public function] Linear time trend for deterministic trend equations.
%
% Backend IRIS function.
% No help provided.

% -IRIS Toolbox.
% -Copyright (c) 2007-2012 Jaromir Benes.

%**************************************************************************

if isempty(range)
    t = range;
else
    freq = datfreq(range(1));
    if freq == 0
        t = range;
    else
        if isempty(THIS.torigin)
            torigin = 2000;
        else
            torigin = datcode(freq,round(THIS.torigin),1);
        end
        t = floor(range - torigin);
    end
end

end
