From 61ee012fa9e8c14f48516fa2f2b00b28b4dd2a69 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 11 Jul 2022 09:57:07 +0200 Subject: [PATCH] Handle different types for second parameter of gettimeofday. --- src/sthread/sthread.c | 8 ++++++-- src/sthread/sthread.h | 4 ++-- src/sthread/sthread_impl.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/sthread/sthread.c b/src/sthread/sthread.c index 0de4be3667..34d42308ed 100644 --- a/src/sthread/sthread.c +++ b/src/sthread/sthread.c @@ -147,9 +147,13 @@ int pthread_mutex_destroy(pthread_mutex_t* mutex) return res; } -int gettimeofday(struct timeval* tv, void* tz) +#if !defined(__GLIBC__) || __GLIBC_PREREQ(2, 31) +int gettimeofday(struct timeval* tv, XBT_ATTRIB_UNUSED void* tz) +#else +int gettimeofday(struct timeval* tv, XBT_ATTRIB_UNUSED struct timezone* tz) +#endif { - return sthread_gettimeofday(tv, tz); + return sthread_gettimeofday(tv); } unsigned int sleep(unsigned int seconds) diff --git a/src/sthread/sthread.h b/src/sthread/sthread.h index 1af86186cd..e13357b5b4 100644 --- a/src/sthread/sthread.h +++ b/src/sthread/sthread.h @@ -40,11 +40,11 @@ int sthread_mutex_trylock(sthread_mutex_t* mutex); int sthread_mutex_unlock(sthread_mutex_t* mutex); int sthread_mutex_destroy(sthread_mutex_t* mutex); -int sthread_gettimeofday(struct timeval* tv, struct timezone* tz); +int sthread_gettimeofday(struct timeval* tv); void sthread_sleep(double seconds); #if defined(__cplusplus) } #endif -#endif \ No newline at end of file +#endif diff --git a/src/sthread/sthread_impl.cpp b/src/sthread/sthread_impl.cpp index 243aa7b801..768a0d55d5 100644 --- a/src/sthread/sthread_impl.cpp +++ b/src/sthread/sthread_impl.cpp @@ -130,7 +130,7 @@ int sthread_mutex_destroy(sthread_mutex_t* mutex) return 0; } -int sthread_gettimeofday(struct timeval* tv, struct timezone* tz) +int sthread_gettimeofday(struct timeval* tv) { if (tv) { double now = simgrid::s4u::Engine::get_clock(); -- 2.20.1