Resonant enhancement of high harmonic generation can be obtained in plasmas containing ions with strong radiative transitions resonant with harmonic orders. The mechanism for this enhancement is still debated. We perform the first temporal characterization of the attosecond emission from a tin plasma under near-resonant conditions for two different resonance detunings. We show that the resonance considerably changes the relative phase of neighbouring harmonics. For very small detunings, their phase locking may even be lost, evidencing strong phase distortions in the emission process and a modified attosecond structure. These features are well reproduced by our simulations, allowing their interpretation in terms of the phase of the recombination dipole moment.