function [toa] = atTimestep(pToa, pStartTimestep, pStartOffset, pDrift)
%CALCULATETOAATTIMESTEP Calculates the TOA at the given timestep.
%   Calculates the new TOA at the given timestep.
%
%   Parameters:
%       pToa (double):              The start TOA.
%       pStartTimestep (double):    The starting timestep.
%       pStartOffset (double):      The start offset of the soundsource.
%       pDrift (double):            The drift of the soundsource in seconds per day.

%% Prepare variables
timesteps = [1:length(pToa)] + pStartTimestep;
if iscolumn(pToa)
    timesteps = timesteps';
end
offsetAtTimesteps = pDrift * timesteps;

%% Calculate new toa
toa = pToa + pStartOffset + offsetAtTimesteps;

end