A numerical analysis of second-harmonic generation in an optical cavity pumped by an external train of pulses is performed. The duration of the pulses is a critical parameter which governs the existence of chaos. To indicate regions of chaos and order, the maximal Lyapunov exponents are used. Limit cycles and chaotic attractors are presented.