[svn:parrot] r41493 - trunk/config/gen/platform/generic
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sat Sep 26 10:46:20 UTC 2009
Author: NotFound
Date: Sat Sep 26 10:46:18 2009
New Revision: 41493
URL: https://trac.parrot.org/parrot/changeset/41493
Log:
[config] Verify clock_getttime availability in generic platform, use gettimeofday if not
Modified:
trunk/config/gen/platform/generic/hires_timer.c
Modified: trunk/config/gen/platform/generic/hires_timer.c
==============================================================================
--- trunk/config/gen/platform/generic/hires_timer.c Sat Sep 26 05:04:17 2009 (r41492)
+++ trunk/config/gen/platform/generic/hires_timer.c Sat Sep 26 10:46:18 2009 (r41493)
@@ -21,6 +21,11 @@
*/
+#include "parrot/has_header.h"
+#ifdef PARROT_HAS_HEADER_UNISTD
+#include <unistd.h>
+#endif
+
#include <time.h>
#define TIME_IN_NS(n) ((n).tv_sec * 1000*1000*1000 + (n).tv_nsec)
@@ -38,7 +43,15 @@
UHUGEINTVAL Parrot_hires_get_time()
{
struct timespec ts;
+ #if _POSIX_TIMERS
clock_gettime(CLOCK_BEST, &ts);
+ #else
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
+ ts.tv_sec = tv.tv_sec;
+ ts.tv_nsec = tv.tv_usec * 1000;
+ #endif
return TIME_IN_NS(ts);
}
More information about the parrot-commits
mailing list