Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1925 - SDL_GetPerformanceFrequency returns incorrect value …
Browse files Browse the repository at this point in the history
…on iOS

PoopiSan

Currently on OSX and iOS simulator the values:
mach_base_info.denom = 1
mach_base_info.numer = 1

but on the real iOS device
mach_base_info.denom = 3
mach_base_info.numer = 125

The calculation is made using following formula
mach_base_info.denom / mach_base_info.numer * 1000000

but all values are int32 and the result is casted to int64.

This solves the problem:

return 1.0 * mach_base_info.denom / mach_base_info.numer * 1000000;
  • Loading branch information
slouken committed Aug 10, 2013
1 parent c51d1c2 commit dfcef77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/timer/unix/SDL_systimer.c
Expand Up @@ -135,9 +135,9 @@ SDL_GetPerformanceFrequency(void)
#if HAVE_CLOCK_GETTIME
return 1000000000;
#elif defined(__APPLE__)
Uint64 freq = mach_base_info.numer;
Uint64 freq = mach_base_info.denom;
freq *= 1000000000;
freq /= mach_base_info.denom;
freq /= mach_base_info.numer;
return freq;
#endif
} else {
Expand Down

0 comments on commit dfcef77

Please sign in to comment.