From time-resolved to frequency-resolved x-ray scattering