Hi there,
According to FreeBSD / Darwin / Linux man page, the low level function
localtime() is not thread safe and we should use locatime_r() instead
to avoid that.
But the pike function localtime() use the low level localtime()
---/ from builtin_functions.c generated file - pike 7.4 /---
[...]
PMOD_EXPORT void f_localtime(INT32 args)
{
struct tm *tm;
INT_TYPE tt;
time_t t;
get_all_args("localtime", args, "%i", &tt);
t = tt;
tm = localtime(&t);
if (!tm) Pike_error ("localtime() on this system cannot handle "
"the timestamp %ld.\n", (long) t);
pop_n_elems(args);
encode_struct_tm(tm);
[...]
---//--
Do you think it should be mutch better to
- either use localtime_r() if OS support it and provide it
- add a mutex or something to avoid threading problems.
Thanks,
/Xavier