function [adjustedToaData] = addDriftByStartEndOffset(pToaData, pOffsetBegin, pOffsetEnd)
%ADDFLOATDRIFT Summary of this function goes here
%   Detailed explanation goes here

%% Prepare return variable
adjustedToaData = pToaData;

%% Parameter check
if pOffsetBegin == 0 && pOffsetEnd == 0
    return;
end
if pOffsetBegin == pOffsetEnd
    adjustedToaData.toa = pToaData.toa + pOffsetEnd;
end

%% Get required data
maxToaDate = max(pToaData.toaDate);
minToaDate = min(pToaData.toaDate);

%% Calculate offset for every toa
offset = ((pOffsetEnd - pOffsetBegin) / (maxToaDate - minToaDate)) ...
    * (pToaData.toaDate - minToaDate) + pOffsetBegin;

%% Add calculated offset to toa data
adjustedToaData.toa = pToaData.toa + offset;


end

