Exchange and correlation kernels at the resonance frequency: Implications for excitation energies in density-functional theory