Use localtime_r rather than localtime if available.