From 2fca31ccc14c0655a21bdc9058096107cd38a42c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 9 Aug 2021 16:14:37 +0200 Subject: Fixed Mingw64 build. * adapted to SonarCloud-CI workflow * removed broken and incomplete Windows example (tested on VS2017/VS2019) * removed unnecessary include (e.g. pthread.h for the library which does not make use of it) Signed-off-by: Toni Uhlig --- src/lib/ndpi_classify.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/ndpi_classify.c') 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); } -- cgit v1.2.3