vcpkg/ports/msolve/fix-android.patch

34 lines
817 B
Diff

diff --git a/src/neogb/tools.c b/src/neogb/tools.c
index 1c85fe6..28b6ebd 100644
--- a/src/neogb/tools.c
+++ b/src/neogb/tools.c
@@ -20,6 +20,10 @@
#include "tools.h"
+#if defined(__ANDROID__) && __ANDROID_API__ < 29
+#include <sys/time.h>
+#endif
+
/* cpu time */
double cputime(void)
{
@@ -32,10 +36,17 @@ double cputime(void)
/* wall time */
double realtime(void)
{
+#if defined(__ANDROID__) && __ANDROID_API__ < 29
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ t.tv_sec -= (2017 - 1970)*3600*24*365;
+ return (1. + (double)t.tv_usec + ((double)t.tv_sec*1000000.)) / 1000000.;
+#else
struct timespec t;
timespec_get(&t, TIME_UTC);
t.tv_sec -= (2017 - 1970)*3600*24*365;
return (1. + (double)t.tv_nsec + ((double)t.tv_sec*1000000000.)) / 1000000000.;
+#endif
}
static void construct_trace(