aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSaggi Mizrahi <saggi@mizrahi.cc>2016-12-22 03:21:04 +0200
committerSaggi Mizrahi <saggi@mizrahi.cc>2016-12-22 03:26:54 +0200
commit1aa775eca8d5fbacb3d5b19143ca08c6b9eca65d (patch)
tree48c40056137c33362b788ccb6bec3e652cf19ae4 /src
parentb2d4cd66a72fd765daa64c27f6a8e529d3d18e2d (diff)
downloadraylib-1aa775eca8d5fbacb3d5b19143ca08c6b9eca65d.tar.gz
raylib-1aa775eca8d5fbacb3d5b19143ca08c6b9eca65d.zip
Fix physac.h building on linux
Signed-off-by: Saggi Mizrahi <saggi@mizrahi.cc>
Diffstat (limited to 'src')
-rw-r--r--src/physac.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/physac.h b/src/physac.h
index e807ffa6..d958c701 100644
--- a/src/physac.h
+++ b/src/physac.h
@@ -239,9 +239,10 @@ PHYSACDEF void ClosePhysics(void);
// Functions required to query time on Windows
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
-#elif defined(__linux)
+#elif defined(__linux) || defined(PLATFORM_WEB)
#include <sys/time.h> // Required for: timespec
#include <time.h> // Required for: clock_gettime()
+ #include <stdint.h>
#endif
//----------------------------------------------------------------------------------
@@ -266,7 +267,7 @@ PHYSACDEF void ClosePhysics(void);
static unsigned int usedMemory = 0; // Total allocated dynamic memory
static bool physicsThreadEnabled = false; // Physics thread enabled state
static double currentTime = 0; // Current time in milliseconds
-#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
+#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB)
static double baseTime = 0; // Android and RPI platforms base time
#endif
static double startTime = 0; // Start time in milliseconds
@@ -1942,7 +1943,7 @@ static double GetCurrentTime(void)
{
double time = 0;
- #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
+ #if defined(_WIN32)
unsigned long long int clockFrequency, currentTime;
QueryPerformanceFrequency(&clockFrequency);
@@ -1951,7 +1952,7 @@ static double GetCurrentTime(void)
time = (double)((double)currentTime/clockFrequency)*1000;
#endif
- #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
+ #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
uint64_t temp = (uint64_t)ts.tv_sec*1000000000LLU + (uint64_t)ts.tv_nsec;