From 291bf93f9d7bd1f85b943715ac8e9d2c74b04f59 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 7 Jul 2019 12:20:47 -0700 Subject: [PATCH] Proper timing --- native/jni/su/su_daemon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/jni/su/su_daemon.cpp b/native/jni/su/su_daemon.cpp index 614a83413..0b5c759d5 100644 --- a/native/jni/su/su_daemon.cpp +++ b/native/jni/su/su_daemon.cpp @@ -47,14 +47,14 @@ void su_info::unlock() { bool su_info::is_fresh() { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - long current = ts.tv_sec * 1000L + ts.tv_nsec / 1000L; + long current = ts.tv_sec * 1000L + ts.tv_nsec / 1000000L; return current - timestamp < 3000; /* 3 seconds */ } void su_info::refresh() { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - timestamp = ts.tv_sec * 1000L + ts.tv_nsec / 1000L; + timestamp = ts.tv_sec * 1000L + ts.tv_nsec / 1000000L; } static void database_check(const shared_ptr &info) {