From b0e996cda326baad856165e51a43498f0471581c Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 28 Apr 2020 20:55:16 +0900 Subject: [PATCH] Attempt to make NetworkTest work on Windows --- src/test/UDPC_NetworkTest.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/UDPC_NetworkTest.c b/src/test/UDPC_NetworkTest.c index b6d2cbc..6773bdb 100644 --- a/src/test/UDPC_NetworkTest.c +++ b/src/test/UDPC_NetworkTest.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #ifdef UDPC_LIBSODIUM_ENABLED @@ -10,6 +9,13 @@ #include +#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS +#include +#include +#elif UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX +#include +#endif + #define QUEUED_MAX_SIZE 32 #define SEND_IDS_SIZE 64 #define WHITELIST_FILES_SIZE 64 @@ -33,10 +39,14 @@ void usage() { } void sleep_seconds(unsigned int seconds) { +#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS + Sleep(seconds * 1000); +#elif UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX struct timespec duration; duration.tv_sec = seconds; duration.tv_nsec = 0; thrd_sleep(&duration, NULL); +#endif } int main(int argc, char **argv) {