Correctly calculating difference of time period in hours