1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

clocktime freebsd portability

* libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD
  implementation of _POSIX_CPUTIME.
This commit is contained in:
Andy Wingo 2011-05-20 17:41:06 +02:00
parent 19761af161
commit a02a606716

View file

@ -142,7 +142,11 @@ get_internal_real_time_posix_timer (void)
ts.tv_nsec - posix_real_time_base.tv_nsec); ts.tv_nsec - posix_real_time_base.tv_nsec);
} }
#ifdef _POSIX_CPUTIME #if defined _POSIX_CPUTIME && defined CLOCK_PROCESS_CPUTIME_ID
/* You see, FreeBSD defines _POSIX_CPUTIME but not
CLOCK_PROCESS_CPUTIME_ID. */
#define HAVE_POSIX_CPUTIME 1
struct timespec posix_run_time_base; struct timespec posix_run_time_base;
static long static long
@ -847,7 +851,7 @@ scm_init_stime()
if (clock_gettime (CLOCK_REALTIME, &posix_real_time_base) == 0) if (clock_gettime (CLOCK_REALTIME, &posix_real_time_base) == 0)
get_internal_real_time = get_internal_real_time_posix_timer; get_internal_real_time = get_internal_real_time_posix_timer;
#ifdef _POSIX_CPUTIME #ifdef HAVE_POSIX_CPUTIME
{ {
clockid_t dummy; clockid_t dummy;
@ -859,7 +863,7 @@ scm_init_stime()
else else
errno = 0; errno = 0;
} }
#endif /* _POSIX_CPUTIME */ #endif /* HAVE_POSIX_CPUTIME */
#endif /* HAVE_CLOCKTIME */ #endif /* HAVE_CLOCKTIME */
/* If needed, init and use gettimeofday timer. */ /* If needed, init and use gettimeofday timer. */