aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-06-11 16:22:53 +0200
committerGitHub <noreply@github.com>2017-06-11 16:22:53 +0200
commit4b1bc7f65eb535aa1d9108e9db080e9179f02f62 (patch)
tree6fc7fa1e38e0e5c22dd03c5fb14bf335925501b5 /src
parentb6d7fa9bb0775023a974a03e7919203a3f757a01 (diff)
parent272073785f17f9b202a5b2a62265bbbd2940b07e (diff)
downloadraylib-4b1bc7f65eb535aa1d9108e9db080e9179f02f62.tar.gz
raylib-4b1bc7f65eb535aa1d9108e9db080e9179f02f62.zip
Merge pull request #301 from jubalh/time
Add define to have CLOCK_MONOTONIC work in c99
Diffstat (limited to 'src')
-rw-r--r--src/core.c4
-rw-r--r--src/gestures.h5
-rw-r--r--src/physac.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index 95f704d1..f2ecfa04 100644
--- a/src/core.c
+++ b/src/core.c
@@ -109,6 +109,10 @@
#include "external/gif.h" // Support GIF recording
#endif
+#if defined(__linux__) || defined(PLATFORM_WEB)
+ #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
+#endif
+
#include <stdio.h> // Standard input / output lib
#include <stdlib.h> // Required for: malloc(), free(), rand(), atexit()
#include <stdint.h> // Required for: typedef unsigned long long int uint64_t, used by hi-res timer
diff --git a/src/gestures.h b/src/gestures.h
index f04bf091..f4d38dfb 100644
--- a/src/gestures.h
+++ b/src/gestures.h
@@ -148,8 +148,9 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
#elif defined(__linux__)
- #include <sys/time.h> // Required for: timespec
- #include <time.h> // Required for: clock_gettime()
+ #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
+ #include <sys/time.h> // Required for: timespec
+ #include <time.h> // Required for: clock_gettime()
#endif
//----------------------------------------------------------------------------------
diff --git a/src/physac.h b/src/physac.h
index d3fdaca4..8c109935 100644
--- a/src/physac.h
+++ b/src/physac.h
@@ -253,6 +253,7 @@ PHYSACDEF void ClosePhysics(void);
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
#elif defined(__linux__) || defined(PLATFORM_WEB)
+ #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
//#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance
#include <sys/time.h> // Required for: timespec
#include <time.h> // Required for: clock_gettime()