Skip to content

Commit

Permalink
Fix Gestures to use GetTime() if it's available (#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach authored Oct 2, 2022
1 parent 03f5fce commit 0daaadd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rgestures.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang

#if defined(GESTURES_IMPLEMENTATION)

#if defined(GESTURES_STANDALONE)
#if defined(_WIN32)
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
Expand All @@ -175,6 +176,7 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
#include <mach/clock.h> // Required for: clock_get_time()
#include <mach/mach.h> // Required for: mach_timespec_t
#endif
#endif

//----------------------------------------------------------------------------------
// Defines and Macros
Expand Down Expand Up @@ -526,6 +528,9 @@ static double rgGetCurrentTime(void)
{
double time = 0;

#if !defined(GESTURES_STANDALONE)
time = GetTime();
#else
#if defined(_WIN32)
unsigned long long int clockFrequency, currentTime;

Expand Down Expand Up @@ -558,6 +563,7 @@ static double rgGetCurrentTime(void)
unsigned long long int nowTime = (unsigned long long int)now.tv_sec*1000000000LLU + (unsigned long long int)now.tv_nsec; // Time in nanoseconds

time = ((double)nowTime/1000000.0); // Time in miliseconds
#endif
#endif

return time;
Expand Down

0 comments on commit 0daaadd

Please sign in to comment.