-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1523 from dpogue/osx-10.5-fixes
Mac OS X 10.5 compiler fixes
- Loading branch information
Showing
5 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,6 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
*==LICENSE==*/ | ||
|
||
#ifdef HS_BUILD_FOR_WIN32 | ||
|
||
#include "HeadSpin.h" | ||
#include "hsWindows.h" | ||
#include <combaseapi.h> | ||
|
@@ -93,5 +91,3 @@ const RTL_OSVERSIONINFOEXW& hsGetWindowsVersion() | |
} | ||
return s_WinVer; | ||
} | ||
|
||
#endif |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,11 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
#include <cmath> | ||
#include <string_theory/format> | ||
|
||
#ifdef HS_BUILD_FOR_APPLE | ||
# include <AvailabilityMacros.h> | ||
# include <sys/time.h> | ||
#endif | ||
|
||
#include "plUnifiedTime.h" | ||
|
||
#include "hsStream.h" | ||
|
@@ -107,10 +112,21 @@ void plUnifiedTime::ToCurrentTime() | |
struct timespec ts; | ||
|
||
#if defined(HS_BUILD_FOR_APPLE) | ||
// timespec_get is only supported since macOS 10.15, | ||
// but clock_gettime exists since macOS 10.12. | ||
int res = clock_gettime(CLOCK_REALTIME, &ts); | ||
hsAssert(res == 0, "clock_gettime failed"); | ||
#if defined(HAVE_BUILTIN_AVAILABLE) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 | ||
if (__builtin_available(macOS 10.15, *)) { | ||
// timespec_get is only supported since macOS 10.15 | ||
int res = timespec_get(&ts, TIME_UTC); | ||
hsAssert(res != 0, "timespec_get failed"); | ||
} else | ||
#endif | ||
{ | ||
struct timeval tv; | ||
int res = gettimeofday(&tv, nullptr); | ||
hsAssert(res == 0, "gettimeofday failed"); | ||
|
||
ts.tv_sec = tv.tv_sec; | ||
ts.tv_nsec = tv.tv_usec * 1000; | ||
} | ||
#else | ||
int res = timespec_get(&ts, TIME_UTC); | ||
hsAssert(res != 0, "timespec_get failed"); | ||
|