-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-4674 Remove unnecessary code from bson-clock.c #1348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/libbson/src/bson/bson-clock.c
Outdated
@@ -16,9 +16,6 @@ | |||
|
|||
|
|||
#ifdef __APPLE__ | |||
#include <mach/clock.h> | |||
#include <mach/mach.h> | |||
#include <mach/mach_time.h> | |||
#include <sys/time.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this include still needed? It dates back to mongodb/libbson@c6e981e, although it's not clear if it was specific to the use of mach_
functions since that commit also included it for the defined(HAVE_CLOCK_GETTIME)
case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/libbson/src/bson/bson-clock.c
Outdated
@@ -16,10 +16,6 @@ | |||
|
|||
|
|||
#ifdef __APPLE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire #ifdef
can be removed if it no longer has a body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I already did this and I have no idea why that commit wasn't showing before. I just made a new commit ("remove empty line") and now the "remove #ifdef" commit is showing 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinAlbs should probably still sign off on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if they are unable to use
bson_get_monotonic_time
sucessfully.
I expect bson_get_monotonic_time
will continue to "succeed" and fall back to the else
case of using bson_gettimeofday
, and show the "Monotonic clock is not yet supported on your platform" warning on compile.
I think that is OK. Support of macOS 10.14 and 10.15 was decidedly dropped in 1.24.0 as part of CDRIVER-4580.
Summary
This PR will remove an
elif
block frombson_get_monotonic_time
that checks if the driver is running on macOS as it serves no purpose anymore.Background
https://jira.mongodb.org/browse/CDRIVER-4565 fixed an assertion failure that occasionally occurred on macOS 10.14. This involved using
clock_gettime_nsec_np
andCLOCK_UPTIME_RAW
to get the monotonic time on macOS machines. However, becauseclock_gettime_nsec_np
andCLOCK_UPTIME_RAW
were introduced in macOS 10.12 andclock_gettime
andCLOCK_MONOTONIC
were introduced in OS X 10.11 (one of these must not be defined to hit theelif
block in question), this function won't compile on OS X 10.10 or earlier.As of now, all supported versions of macOS have
clock_gettime
andCLOCK_MONOTONIC
, so thiselif
statement is no longer necessary. This PR will also ensure that the driver will compile on older versions of OS X, even if they are unable to usebson_get_monotonic_time
sucessfully.What's New
bson_get_monotonic_time
bson-clock.c