Skip to content

Commit

Permalink
sys.cpp: use clock_gettime on macOS when supported
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Feb 2, 2024
1 parent 8dac981 commit e937341
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/occa/internal/utils/sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# else // OCCA_MACOS_OS
# include <AvailabilityMacros.h>
# include <mach/mach_host.h>
# ifdef __clang__
# if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
# include <CoreServices/CoreServices.h>
# include <mach/mach_time.h>
# else
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace occa {

return (double) (ct.tv_sec + (1.0e-9 * ct.tv_nsec));
#elif (OCCA_OS == OCCA_MACOS_OS)
# if defined __clang__ && defined CLOCK_UPTIME_RAW
# if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
uint64_t nanoseconds = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);

return 1.0e-9 * nanoseconds;
Expand Down

0 comments on commit e937341

Please sign in to comment.