Calculating longitude and time