Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: mozilla/nsprpub/pr/src/md/unix/darwin.c

Issue 12089033: Update to NSPR 4.9.5 Beta 2, part 2: actual changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mozilla/nsprpub/pr/src/md/prosdep.c ('k') | mozilla/nsprpub/pr/src/md/unix/unix.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mozilla/nsprpub/pr/src/md/unix/darwin.c
===================================================================
--- mozilla/nsprpub/pr/src/md/unix/darwin.c (revision 179237)
+++ mozilla/nsprpub/pr/src/md/unix/darwin.c (working copy)
@@ -5,10 +5,45 @@
#include "primpl.h"
+#include <mach/mach_time.h>
+
void _MD_EarlyInit(void)
{
}
+/*
+ * The multiplier (as a fraction) for converting the Mach absolute time
+ * unit to nanoseconds.
+ */
+static mach_timebase_info_data_t machTimebaseInfo;
+
+void _PR_Mach_IntervalInit(void)
+{
+ kern_return_t rv;
+
+ rv = mach_timebase_info(&machTimebaseInfo);
+ PR_ASSERT(rv == KERN_SUCCESS);
+}
+
+PRIntervalTime _PR_Mach_GetInterval(void)
+{
+ uint64_t time;
+
+ /*
+ * mach_absolute_time returns the time in the Mach absolute time unit.
+ * Convert it to milliseconds. See Mac Technical Q&A QA1398.
+ */
+ time = mach_absolute_time();
+ time = time * machTimebaseInfo.numer / machTimebaseInfo.denom /
+ PR_NSEC_PER_MSEC;
+ return (PRIntervalTime)time;
+} /* _PR_Mach_GetInterval */
+
+PRIntervalTime _PR_Mach_TicksPerSecond(void)
+{
+ return 1000;
+}
+
PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
{
#if !defined(_PR_PTHREADS)
« no previous file with comments | « mozilla/nsprpub/pr/src/md/prosdep.c ('k') | mozilla/nsprpub/pr/src/md/unix/unix.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698