His clock says t1 when he leaves. The time on his friends clock when he arrives is T, so his apparent journey time is δt = T - t1. He stays for a known time δT.
Assuming his apparent return journey time is also δt then his apparent round trip takes 2δt + δT or 2(T - t1) + δT. His clock now reads t2.
Assuming his clock runs at the right speed the interval Δt = t2-t1 is the true interval (though neither t1 nor t2 show the true time).
half the difference between the true interval and the apparent interval gives the required correction:
correction = (2(T-t1) + δT - Δt)/2
All the values on the RHS are known, so he knows the size of the correction. If it is positive the apparent interval is longer than the true interval, which means his clock is behind true time. If it is negative the apparent interval is shorter than the true interval and his clock is ahead of true time.
So he knows by how much and in what direction to adjust his clock.
.