How to calculate the phase shift AND time delay of non-periodic signals
A pure time delay could be determined by looking for a peak in the cross correlation. But in your case $f2$ might also have an overall phase offset.

You could try to compute two cross correlations:

$$
\begin{align}
x &amp;= cross(f1,f2) \\
y &amp;= cross(f1,hilbert(f2)) \\
\end{align}
$$

where $hilbert(f2)$ refers to an overall 90° phase shifted version of $f2$. If you combine those two like this

$$ z = \sqrt{x^2 + y^2} $$

you should get something that is independent of the phase shift and shows you a peak at the correct time delay $\Delta t$. The "phase" at that peak, $atan2(y,x)$ should give you the phase offset $\Delta\phi$.

I don't know if such a problem is usually solved this way and I have not tried it myself. But it might work.