refactored timeToString function