add localtime_safe instead localtime_r (deadlock in multithread)