Fix Windows build errors: config_parser.h, poll(), localtime()

- Replace sys/socket.h with platform_compat.h in config_parser.h
- Add #include <poll.h> for Windows in platform_compat.h
- Fix localtime() type mismatch: cast tv.tv_sec to time_t
- All 22 tests pass on Linux
This commit is contained in:
Evgeny committed 2026-02-15 02:56:08 +03:00
1 parent 0688efcd0e
commit 1bd4bf5d11
3 files changed
+6 -4

No files matched your search

+2 -1
View File
@@ -217,7 +217,8 @@ void debug_output(debug_level_t level, debug_category_t category,
/* Add timestamp with microseconds: hh:mm:ss-xxx.yyy */
struct timeval tv;
gettimeofday(&tv, NULL);
struct tm* tm_info = localtime(&tv.tv_sec);
time_t tv_sec = (time_t)tv.tv_sec;
struct tm* tm_info = localtime(&tv_sec);
char time_str[32];
strftime(time_str, sizeof(time_str), "%H:%M:%S", tm_info);
offset += snprintf(buffer + offset, remaining, "[%s-%03ld.%03ld] ", time_str, tv.tv_usec / 1000, tv.tv_usec % 1000);
+3
View File
@@ -103,6 +103,9 @@
// nanosleep already defined in pthread_time.h on MSYS2
// poll is in ws2tcpip.h or poll.h on MSYS2
#include <poll.h>
#else
// POSIX - include standard headers
#include <sys/time.h>