Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix compilation on macos and with MC
authordegomme <augustin.degomme@unibas.ch>
Sat, 18 Jun 2016 21:01:15 +0000 (23:01 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Sat, 18 Jun 2016 21:01:15 +0000 (23:01 +0200)
include/smpi/mpi.h
include/smpi/smpi.h
src/smpi/smpi_bench.cpp

index ee9e433..58ccde0 100644 (file)
@@ -10,8 +10,8 @@
 #define SEED 221238
 
 #define sleep(x) smpi_sleep(x)
-#if _POSIX_TIMERS
-#define nanosleep(x,y) smpi_nanosleep(x,NULL)
+#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L
+#define nanosleep(x, y) smpi_nanosleep(x, y)
 #endif
 #define usleep(x) smpi_usleep(x)
 
@@ -23,7 +23,7 @@
 
 #include <sys/time.h> /* Load it before the define next line to not mess with the system headers */
 #define gettimeofday(x, y) smpi_gettimeofday(x, NULL)
-#if _POSIX_TIMERS
+#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L
 #define clock_gettime(x, y) smpi_clock_gettime(x, y)
 #endif
 #if HAVE_MC
index 73fdb68..c04940d 100644 (file)
@@ -806,9 +806,8 @@ XBT_PUBLIC(int)  smpi_get_host_pstate(void);
 XBT_PUBLIC(double) smpi_get_host_consumed_energy(void);
 
 XBT_PUBLIC(int) smpi_usleep(useconds_t usecs);
-#if _POSIX_TIMERS
-
-XBT_PUBLIC(int) smpi_nanosleep(struct timespec *tp, void* t);
+#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L
+XBT_PUBLIC(int) smpi_nanosleep(const struct timespec *tp, struct timespec * t);
 XBT_PUBLIC(int) smpi_clock_gettime(clockid_t clk_id, struct timespec *tp);
 #endif
 XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
index 91be166..1079ca4 100644 (file)
@@ -307,8 +307,8 @@ int smpi_usleep(useconds_t usecs)
   return static_cast<int>(private_sleep(static_cast<double>(usecs) / 1000000.0));
 }
 
-#if _POSIX_TIMERS
-int smpi_nanosleep(struct timespec *tp, void* t)
+#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L
+int smpi_nanosleep(const struct timespec *tp, struct timespec * t)
 {
   return static_cast<int>(private_sleep(static_cast<double>(tp->tv_sec + tp->tv_nsec / 1000000000.0)));
 }
@@ -331,7 +331,7 @@ int smpi_gettimeofday(struct timeval *tv, void* tz)
   return 0;
 }
 
-#if _POSIX_TIMERS
+#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L
 int smpi_clock_gettime(clockid_t clk_id, struct timespec *tp)
 {
   //there is only one time in SMPI, so clk_id is ignored.