Shapiro time delay is the effect where light passing close to a massive object will take longer to reach the observer than light travelling a similar distance in vacuum. This arises due to the curvature of space-time in General Relativity, and is considered to be one of the classical tests of the theory. Consider a photon travelling by a mass $ M $ with an impact parameter $ b $. Using Schwarzschild metric with a light-like path ($ ds^2=0 $) we get (in polar coordinates around the mass $ M $):

$ 0=(1-\frac{2GM}{c^2 r})c^2dt^2-\frac{dr^2}{1-\frac{2GM}{c^2 r}}-r^2d\phi^2 $.

The unperturbed, straight line solution, is given by: $ rsin \phi =b $(which is not a geodesic). It follows that: $ -\frac{dr}{r^2}=\frac{cos \phi}{b}d\phi $ which leads to: $ r^2 d\phi^2=\frac{b^2 dr^2}{r^2-b^2} $. The metric can be re-written as:

$ c^2dt^2=dr^2 [(1-\frac{2GM}{c^2 r})^{-2}+(1-\frac{2GM}{c^2 r})^{-1}\frac{b^2}{r^2-b^2}] $.

Expanding in the small parameter $ \frac{GM}{c^2r} $ we get:

$ cdt=\pm \frac{rdr}{\sqrt{r^2-b^2}}\bigg[1+\frac{2GM}{c^2r}-\frac{GMb^2}{c^2r^3}\bigg] $

This expression may be integrated between two locations $ A $ and $ B $ to give the time it takes light to travel between these locations:

$ c \Delta t=\pm \bigg[\sqrt{r^2-b^2}+\frac{2GM}{c^2}\ln(\sqrt{\frac{r^2}{b^2}-1}+\frac{r}{b})-\frac{GM}{c^2}\sqrt{1-\frac{b^2}{r^2}}\bigg]_A^B $

The first term is the Newtonian delay between emission at $ A $ and absorption at $ B $, while the other terms are corrections due to the curvature of space-time.