Use localtime_r instead of localtime to save a memcpy() call