correct implementation of format_timedelta