Fixed incorrect time calculation