Analytic and Gevrey well-posedness of the Cauchy problem for second order hyperbolic equations with coefficients irregular in time