Distance and time computation