fixed error in time difference computation