The period function of a Hamiltonian quadratic system