We present a new method of measuring the mass density along the line of sight, based on precise measurements of the variations of the times of arrival (TOA's) of electromagnetic signals propagating between two distant regions of spacetime. The TOA variations are measured between a number of slightly displaced pairs of points from the two regions. These variations are due to the nonrelativistic geometric effects (Roemer delays and finite distance effects) as well as the gravitational effects in the light propagation (gravitational ray bending and Shapiro delays). We show that from a sufficiently broad sample of TOA measurements we can determine two scalars quantifying the impact of the spacetime curvature on the light propagation, directly related to the first two moments of the mass density distribution along the line of sight. The values of the scalars are independent of the angular positions or the states of motion of the two clock ensembles we use for the measurement and free from any influence of masses off the line of sight. These properties can make the mass density measurements very robust. The downside of the method is the need for extremely precise signal timing.