Measurement of femtometre-scale atomic displacements by X-ray absorption spectroscopy