Calculate time in hours