Time reconstruction and performance of the CMS electromagnetic calorimeter