File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,9 +45,19 @@ void msec_sleep_tv(struct timeval *tv) {
4545#define sleep_select select
4646#endif
4747
48- #if CLOCKS_PER_SEC == 1000000 // POSIX
48+ // mingw32 defines CLOCKS_PER_SEC as ((clock_t)<somevalue>) but preprocessor does not handle casts
49+ #if defined(__MINGW32__ ) && !defined(__MINGW64_VERSION_MAJOR )
50+ #define MP_REMOVE_BRACKETSA (x )
51+ #define MP_REMOVE_BRACKETSB (x ) MP_REMOVE_BRACKETSA x
52+ #define MP_REMOVE_BRACKETSC (x ) MP_REMOVE_BRACKETSB x
53+ #define MP_CLOCKS_PER_SEC MP_REMOVE_BRACKETSC(CLOCKS_PER_SEC)
54+ #else
55+ #define MP_CLOCKS_PER_SEC CLOCKS_PER_SEC
56+ #endif
57+
58+ #if defined(MP_CLOCKS_PER_SEC ) && (MP_CLOCKS_PER_SEC == 1000000 ) // POSIX
4959#define CLOCK_DIV 1000.0
50- #elif CLOCKS_PER_SEC == 1000 // WIN32
60+ #elif defined( MP_CLOCKS_PER_SEC ) && ( MP_CLOCKS_PER_SEC == 1000 ) // WIN32
5161#define CLOCK_DIV 1.0
5262#else
5363#error Unsupported clock() implementation
Original file line number Diff line number Diff line change 2626
2727#include <stdlib.h>
2828#include <stdio.h>
29- #include <Windows .h>
29+ #include <windows .h>
3030
3131HANDLE hSleepEvent = NULL ;
3232
Original file line number Diff line number Diff line change 2424 * THE SOFTWARE.
2525 */
2626
27- #include <Windows .h>
27+ #include <windows .h>
2828
2929extern HANDLE hSleepEvent ;
3030
You can’t perform that action at this time.
0 commit comments