supposed reentrant versions of library functions such as localtime_r() are not really thread safe

``localtime_r()`` updates the internal static jtm object first, then moves it's data into result structure. This is wrong, since multiple instances of re-entrant functions might do this resulting in a corrupted output. Re-entrant versions of library function calls must update results passed to them first, then update the static jtm object.