[svn:parrot] r41087 - in trunk: . config/gen/platform/darwin
dukeleto at svn.parrot.org
dukeleto at svn.parrot.org
Mon Sep 7 00:17:29 UTC 2009
Author: dukeleto
Date: Mon Sep 7 00:17:23 2009
New Revision: 41087
URL: https://trac.parrot.org/parrot/changeset/41087
Log:
[build] Fix build on darwin by using gettimeofday instead of clock_gettime, darbelo++, darwin--
Added:
trunk/config/gen/platform/darwin/hires_timer.c
Modified:
trunk/MANIFEST
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Sun Sep 6 23:10:37 2009 (r41086)
+++ trunk/MANIFEST Mon Sep 7 00:17:23 2009 (r41087)
@@ -337,6 +337,7 @@
config/gen/platform/cygwin/math.c []
config/gen/platform/darwin/begin.c []
config/gen/platform/darwin/memalign.c []
+config/gen/platform/darwin/hires_timer.c []
config/gen/platform/generic/dl.c []
config/gen/platform/generic/dl.h []
config/gen/platform/generic/env.c []
Added: trunk/config/gen/platform/darwin/hires_timer.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/config/gen/platform/darwin/hires_timer.c Mon Sep 7 00:17:23 2009 (r41087)
@@ -0,0 +1,81 @@
+/*
+ * $Id$
+ * Copyright (C) 2009, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/generic/hires_timer.c
+
+=head1 DESCRIPTION
+
+High-resolution timer support
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include <time.h>
+
+#define TIME_IN_NS(n) ((n).tv_sec * 1000*1000*1000 + (n).tv_nsec)
+
+/*
+
+=item C<UHUGEINTVAL Parrot_hires_get_time()>
+
+Return a high-resolution number representing how long Parrot has been running.
+
+=cut
+
+*/
+
+UHUGEINTVAL Parrot_hires_get_time()
+{
+ struct timespec ts;
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
+ ts.tv_sec = tv.tv_sec;
+ ts.tv_nsec = tv.tv_usec * 1000;
+
+ return TIME_IN_NS(ts);
+}
+
+/*
+
+=item C<UINTVAL Parrot_hires_get_tick_duration()>
+
+Return the number of ns that each time unit from Parrot_hires_get_time represents.
+
+=cut
+
+*/
+
+UINTVAL Parrot_hires_get_tick_duration()
+{
+ return (UINTVAL) 1;
+}
+
+
+
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
More information about the parrot-commits
mailing list