diff -ru Devel-NYTProf-3.01/Makefile.PL Devel-NYTProf-3.01.patched/Makefile.PL
--- Devel-NYTProf-3.01/Makefile.PL	2009-12-20 21:22:26.000000000 +0100
+++ Devel-NYTProf-3.01.patched/Makefile.PL	2010-01-06 12:38:38.000000000 +0100
@@ -67,7 +67,7 @@
 my @h_dirs;
 push @h_dirs, split /:/, $ENV{INCLUDE} if $ENV{INCLUDE};
 push @h_dirs, split ' ', $Config{libsdirs};
-push @h_dirs, qw(/include /usr/include /usr/local/include);
+push @h_dirs, qw(/include /usr/include /usr/local/include /usr/include/mach);
 @h_dirs = grep { -d $_ } @h_dirs;
 
 $h_files = find_h_files(@h_dirs);
@@ -82,11 +82,17 @@
 	) {
     my ($header, $regexp, $define, $libs) = @$_;
     if (my $result = search_h_file($header, $regexp)) {
-	print "Found $result in $header\n";
-	push @libs, $libs;
-	$mm_opts{DEFINE} .= " $define";
+		print "Found $result in $header\n";
+		push @libs, $libs;
+		$mm_opts{DEFINE} .= " $define";
     }
 }
+
+if( $^O eq 'darwin' and search_h_file('mach_time.h', qr/(mach_absolute_time)\s*\(/)) {
+	print "Found mach_absolute_time in mach/mach_time.h.h\n";
+	$mm_opts{DEFINE} .= " -DHAS_MACH_TIME";
+}
+
 if ($opt_assert or (not defined $opt_assert and $is_developer)) {
     warn "Assertion testing enabled\n";
     $mm_opts{DEFINE} .= " -DUSE_HARD_ASSERT";
diff -ru Devel-NYTProf-3.01/NYTProf.xs Devel-NYTProf-3.01.patched/NYTProf.xs
--- Devel-NYTProf-3.01/NYTProf.xs	2009-12-28 22:49:47.000000000 +0100
+++ Devel-NYTProf-3.01.patched/NYTProf.xs	2010-01-06 13:04:35.000000000 +0100
@@ -267,6 +267,7 @@
 
 /* time tracking */
 static struct tms start_ctime, end_ctime;
+
 #ifdef HAS_CLOCK_GETTIME
 /* http://www.freebsd.org/cgi/man.cgi?query=clock_gettime
  * http://webnews.giga.net.tw/article//mailing.freebsd.performance/710
@@ -285,6 +286,24 @@
 
 #else                                             /* !HAS_CLOCK_GETTIME */
 
+#ifdef HAS_MACH_TIME
+
+#include <mach/mach.h>
+#include <mach/mach_time.h>
+
+mach_timebase_info_data_t  our_timebase;
+typedef uint64_t time_of_day_t;
+
+#  define CLOCKS_PER_TICK 10000000                /* 10 million - 100ns */
+#  define get_time_of_day(into) if(!profile_zero) into = mach_absolute_time()
+#  define get_ticks_between(s, e, ticks, overflow) STMT_START { \
+    overflow = 0; \
+    if( our_timebase.denom == 0 ) mach_timebase_info(&our_timebase); \
+    ticks = (e-s) * our_timebase.numer / our_timebase.denom / 100; \
+} STMT_END
+
+#else                                             /* !HAS_MACH_TIME */
+
 #ifdef HAS_GETTIMEOFDAY
 typedef struct timeval time_of_day_t;
 #  define CLOCKS_PER_TICK 1000000                 /* 1 million */
@@ -304,6 +323,8 @@
 } STMT_END
 #endif
 #endif
+#endif
+
 static time_of_day_t start_time;
 static time_of_day_t end_time;
 
