Measurement of the Z boson pair-production cross section in proton-proton collisions at 7 and 8 TeV, and ECAL timing studies for the phase-2 upgrade of the CMS experiment