Time delay and resonances in potential scattering