diff options
Diffstat (limited to 'src/lib/ndpi_classify.c')
-rw-r--r-- | src/lib/ndpi_classify.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/ndpi_classify.c b/src/lib/ndpi_classify.c index a7a02cb4e..bea56afef 100644 --- a/src/lib/ndpi_classify.c +++ b/src/lib/ndpi_classify.c @@ -688,7 +688,13 @@ ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len) gettimeofday(&tv, NULL); nowtime = tv.tv_sec; +#ifdef WIN32 + /* localtime() on Windows is thread-safe */ + struct tm * nowtm_r_ptr = localtime(&nowtime); + nowtm_r = *nowtm_r_ptr; +#else localtime_r(&nowtime, &nowtm_r); +#endif strftime(tmbuf, NDPI_TIMESTAMP_LEN, "%H:%M:%S", &nowtm_r); snprintf(log_ts, log_ts_len, "%s.%06ld", tmbuf, (long)tv.tv_usec); } |