Mercurial > hg > fxanalyse
diff future.h @ 239:ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Thu, 12 Feb 2015 19:13:55 +0100 |
parents | a2f99632a80c |
children | 7fd5cb857d07 |
line wrap: on
line diff
--- a/future.h Thu Jan 29 18:40:07 2015 +0100 +++ b/future.h Thu Feb 12 19:13:55 2015 +0100 @@ -1,23 +1,27 @@ #ifndef __FUTURE_H__ #define __FUTURE_H__ +/* required for time_t definition */ +#include <time.h> + #define PTR_TO_INT(p) ((int) ((intptr_t)(p))) #define INT_TO_PTR(u) ((void *) ((intptr_t)(u))) double round(double x); -typedef unsigned int time_t; -typedef long int suseconds_t; - -struct timeval { - time_t tv_sec; /* seconds since 1970-01-01 */ - suseconds_t tv_usec; /* microseconds */ +/* struct timeval is defined in `WinSock2.h` but we cannot safely include + * this header because it includes `Windows.h` and CVI does not like to + * have that included after his includes. resort to this ugly hack to + * avoid to include windows headers and to avoid name clashes */ +struct __timeval { + time_t tv_sec; + long tv_usec; }; -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; +#define timeval __timeval + +/* we never use struct timezone so leave it as on opaque struct */ +struct timezone; int gettimeofday(struct timeval *tp, struct timezone *tzp);