Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

Commit c6e981e

Browse files
author
Christian Hergert
committed
clock: fix includes on osx 10.6.8.
1 parent 557f08e commit c6e981e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bson/bson-clock.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
#ifdef __APPLE__
2323
# include <mach/clock.h>
2424
# include <mach/mach.h>
25-
#elif defined(HAVE_CLOCK_GETTIME)
25+
# include <mach/mach_time.h>
26+
# include <sys/time.h>
27+
#endif
28+
29+
#if defined(HAVE_CLOCK_GETTIME)
2630
# include <time.h>
2731
# include <sys/time.h>
2832
#endif
@@ -124,14 +128,14 @@ bson_get_monotonic_time (void)
124128
return ((ts.tv_sec * 1000000UL) + (ts.tv_nsec / 1000UL));
125129
#elif defined(__APPLE__)
126130
static mach_timebase_info_data_t info = { 0 };
127-
static double ratio;
131+
static double ratio = 0.0;
128132

129133
if (!info.denom) {
130-
mach_timebase_info(&info);
134+
mach_timebase_info (&info);
131135
ratio = info.numer / info.denom;
132136
}
133137

134-
return (mach_absolute_time() * ratio);
138+
return mach_absolute_time () * ratio;
135139
#elif defined(_WIN32)
136140
return GetTickCount64 ();
137141
#else

0 commit comments

Comments
 (0)