Reworked getFormattedTime.