This commit is contained in:
blueloveTH 2024-08-14 19:59:54 +08:00
parent 3cc46df47b
commit 3d5a59bd15
2 changed files with 6 additions and 4 deletions

View File

@ -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")

View File

@ -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 */