Fix time computation bug