Fixed secondsToHMS function