Created
September 26, 2008 18:03
-
-
Save mernen/13163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/vm/profiler.cpp b/vm/profiler.cpp | |
index 17353d2..05b13b6 100644 | |
--- a/vm/profiler.cpp | |
+++ b/vm/profiler.cpp | |
@@ -19,8 +19,15 @@ | |
#else | |
-#define current_time() ((uint64_t)clock()) | |
-#define METHOD "clock" | |
+uint64_t current_time() { | |
+ timespec tp; | |
+ if (clock_gettime(CLOCK_REALTIME, &tp)) { | |
+ // error! Do something about it? | |
+ return 0U; | |
+ } | |
+ return tp.tv_sec * 1000000000UL + tp.tv_nsec; | |
+} | |
+#define METHOD "clock_gettime" | |
#endif | |
@@ -69,7 +76,7 @@ namespace rubinius { | |
return time * timebase.numer / timebase.denom; | |
#else | |
- return time / (CLOCKS_PER_SEC * 1000000000UL); | |
+ return time; | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment