[th/use-localtime-r] use localtime_r() in g_log_writer_format_fields()

Thomas Haller requested to merge th/use-localtime-r into main

localtime() is not guaranteed to be threadsafe. Use localtime_r() if we have it.

for that, first extract the wrapper around the #ifdef HAVE_LOCALTIME_R to a separate (internal) helper function.

Merge request reports