Accurate determination of X-ray energies using powder diffraction