handle errors from localtime_r in ctime_r