On PPC systems default to gettimeofday() on ms resolution (fix
ppc/32 and ppc/64 do not support CLOCK_MONOTONIC_COARSE in vdso
# include <windows.h>
#elif defined(HG_UTIL_HAS_TIME_H) && defined(HG_UTIL_HAS_CLOCK_GETTIME)
# include <time.h>
+# if (!defined(HG_UTIL_HAS_CLOCK_MONOTONIC_COARSE) || defined(__ppc64__) || \
+ defined(__ppc__)) && \
+ defined(HG_UTIL_HAS_SYSTIME_H)
+# include <sys/time.h>
+# endif
#elif defined(__APPLE__) && defined(HG_UTIL_HAS_SYSTIME_H)
# include <mach/mach_time.h>
# include <sys/time.h>
@@ -267,10 +272,20 @@ hg_time_get_current(hg_time_t *tv)
static HG_UTIL_INLINE int
hg_time_get_current_ms(hg_time_t *tv)
{
-# ifdef HG_UTIL_HAS_CLOCK_MONOTONIC_COARSE
+ /* ppc/32 and ppc/64 do not support CLOCK_MONOTONIC_COARSE in vdso */
+# if defined(HG_UTIL_HAS_CLOCK_MONOTONIC_COARSE) && !defined(__ppc64__) && \
+ !defined(__ppc__)
/* We don't need fine grain time stamps, _COARSE resolution is 1ms */
clock_gettime(CLOCK_MONOTONIC_COARSE, tv);
+ return HG_UTIL_SUCCESS;
+# elif defined(HG_UTIL_HAS_SYSTIME_H)
+ struct timeval _tv;
+
+ gettimeofday(&_tv, NULL);
+ tv->tv_sec = _tv.tv_sec;
+ tv->tv_nsec = _tv.tv_usec * 1000;
+
return HG_UTIL_SUCCESS;
# else
return hg_time_get_current(tv);
@@ -334,6 +349,7 @@ hg_time_to_double(hg_time_t tv)
#endif
}
+/*---------------------------------------------------------------------------*/
static HG_UTIL_INLINE unsigned int
hg_time_to_ms(hg_time_t tv)
{
@@ -344,6 +360,7 @@ hg_time_to_ms(hg_time_t tv)
#endif
}
+/*---------------------------------------------------------------------------*/
static HG_UTIL_INLINE hg_time_t
hg_time_from_ms(unsigned int ms)
{
