comparison 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
comparison
equal deleted inserted replaced
238:78fdba868884 239:ec81395bf08d
1 #ifndef __FUTURE_H__ 1 #ifndef __FUTURE_H__
2 #define __FUTURE_H__ 2 #define __FUTURE_H__
3
4 /* required for time_t definition */
5 #include <time.h>
3 6
4 #define PTR_TO_INT(p) ((int) ((intptr_t)(p))) 7 #define PTR_TO_INT(p) ((int) ((intptr_t)(p)))
5 #define INT_TO_PTR(u) ((void *) ((intptr_t)(u))) 8 #define INT_TO_PTR(u) ((void *) ((intptr_t)(u)))
6 9
7 double round(double x); 10 double round(double x);
8 11
9 typedef unsigned int time_t; 12 /* struct timeval is defined in `WinSock2.h` but we cannot safely include
10 typedef long int suseconds_t; 13 * this header because it includes `Windows.h` and CVI does not like to
11 14 * have that included after his includes. resort to this ugly hack to
12 struct timeval { 15 * avoid to include windows headers and to avoid name clashes */
13 time_t tv_sec; /* seconds since 1970-01-01 */ 16 struct __timeval {
14 suseconds_t tv_usec; /* microseconds */ 17 time_t tv_sec;
18 long tv_usec;
15 }; 19 };
16 20
17 struct timezone { 21 #define timeval __timeval
18 int tz_minuteswest; 22
19 int tz_dsttime; 23 /* we never use struct timezone so leave it as on opaque struct */
20 }; 24 struct timezone;
21 25
22 int gettimeofday(struct timeval *tp, struct timezone *tzp); 26 int gettimeofday(struct timeval *tp, struct timezone *tzp);
23 27
24 #endif 28 #endif