Hi,

time.in.h reads:

--8<---------------cut here---------------start------------->8---
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
   Or they define it with the wrong member names or define it in <sys/time.h>
   (e.g., FreeBSD circa 1997).  Stock Mingw does not define it, but the
   pthreads-win32 library defines it in <pthread.h>.  */
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
#   include <sys/time.h>
#  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
#   include <pthread.h>
/* The pthreads-win32 <pthread.h> also defines a couple of broken macros.  */
[...]
--8<---------------cut here---------------end--------------->8---

Unfortunately, pthreads-win32 1.10.0 <pthread.h> does this:

--8<---------------cut here---------------start------------->8---
#if HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

[...]

#ifndef HAVE_STRUCT_TIMESPEC
#define HAVE_STRUCT_TIMESPEC 1
struct timespec {
        long tv_sec;
        long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
--8<---------------cut here---------------end--------------->8---

... which causes ‘struct timespec’ to never be defined (see
<http://hydra.nixos.org/build/4516231> for an example.)

I’m thinking of a workaround along these lines:

diff --git a/lib/time.in.h b/lib/time.in.h
index 71dcc36..d78a8a2 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -62,6 +62,7 @@
 #   undef localtime_r
 #   undef rand_r
 #   undef strtok_r
+#   undef HAVE_STRUCT_TIMESPEC
 #  else
 
 #   ifdef __cplusplus
Thoughts?

Thanks,
Ludo’.

Reply via email to