Swift extensions to calculate time