diff --git a/cmake_build.py b/cmake_build.py index 1ac71228..925fd4b6 100644 --- a/cmake_build.py +++ b/cmake_build.py @@ -31,4 +31,4 @@ elif sys.platform == "darwin": shutil.copy("libpocketpy.dylib", "../libpocketpy.dylib") else: shutil.copy("main", "../main") - # shutil.copy("libpocketpy.so", "../libpocketpy.so") + shutil.copy("libpocketpy.so", "../libpocketpy.so") diff --git a/src/modules/time.c b/src/modules/time.c index 506d3e3b..de21067f 100644 --- a/src/modules/time.c +++ b/src/modules/time.c @@ -6,10 +6,12 @@ static bool get_ns(int64_t* out) { struct timespec tms; +#ifdef __ANDROID__ + clock_gettime(CLOCK_REALTIME, &tms); +#else /* The C11 way */ - if(!timespec_get(&tms, TIME_UTC)) { - return py_exception(tp_OSError, "%s", "timespec_get() failed"); - } + timespec_get(&tms, TIME_UTC); +#endif /* seconds, multiplied with 1 billion */ int64_t nanos = tms.tv_sec * NANOS_PER_SEC; /* Add full nanoseconds */