This repository was archived by the owner on Oct 15, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
deps/chakrashim/core/pal/src Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -342,9 +342,12 @@ check_cxx_source_runs("
342342int main()
343343{
344344 int ret;
345+ #ifndef __APPLE__
345346 struct timespec ts;
346347 ret = clock_gettime(CLOCK_REALTIME, &ts);
347-
348+ #else
349+ ret = 1; // do not use clock_gettime on osx/ios (backward compatibility)
350+ #endif
348351 exit(ret);
349352}" HAVE_WORKING_CLOCK_GETTIME)
350353check_cxx_source_runs("
@@ -355,9 +358,12 @@ check_cxx_source_runs("
355358int main()
356359{
357360 int ret;
361+ #ifndef __APPLE__
358362 struct timespec ts;
359363 ret = clock_gettime(CLOCK_MONOTONIC, &ts);
360-
364+ #else
365+ ret = 1; // do not use clock_gettime on osx/ios (backward compatibility)
366+ #endif
361367 exit(ret);
362368}" HAVE_CLOCK_MONOTONIC)
363369check_cxx_source_runs("
@@ -368,9 +374,12 @@ check_cxx_source_runs("
368374int main()
369375{
370376 int ret;
377+ #ifndef __APPLE__
371378 struct timespec ts;
372379 ret = clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
373-
380+ #else
381+ ret = 1; // do not use clock_gettime on osx/ios (backward compatibility)
382+ #endif
374383 exit(ret);
375384}" HAVE_CLOCK_MONOTONIC_COARSE)
376385check_cxx_source_runs("
@@ -393,9 +402,12 @@ check_cxx_source_runs("
393402int main()
394403{
395404 int ret;
405+ #ifndef __APPLE__
396406 struct timespec ts;
397407 ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
398-
408+ #else
409+ ret = 1; // do not use clock_gettime on osx/ios (backward compatibility)
410+ #endif
399411 exit(ret);
400412}" HAVE_CLOCK_THREAD_CPUTIME)
401413check_cxx_source_runs("
Original file line number Diff line number Diff line change @@ -329,7 +329,10 @@ GetTickCount64Fallback()
329329{
330330 ULONGLONG retval = 0 ;
331331
332- #if HAVE_CLOCK_MONOTONIC_COARSE || HAVE_CLOCK_MONOTONIC
332+ // The `__APPLE__` below is unlikely. However, if osx future version
333+ // supports one of the clock types below, we may miss that and
334+ // break backward compatibility.
335+ #if !defined(__APPLE__) && (HAVE_CLOCK_MONOTONIC_COARSE || HAVE_CLOCK_MONOTONIC)
333336 {
334337 clockid_t clockType =
335338#if HAVE_CLOCK_MONOTONIC_COARSE
You can’t perform that action at this time.
0 commit comments