/** Detect suspend/resume cycle from CLOCK_MONOTONIC vs CLOCK_BOOTTIME */ static void io_detect_resume(void) { static int64_t prev = 0; int64_t boot = mce_lib_get_boot_tick(); int64_t mono = mce_lib_get_mono_tick(); int64_t diff = boot - mono; int64_t skip = diff - prev; // small jitter can be due to scheduling too if( skip < 100 ) goto EXIT; prev = diff; // no logging from the 1st time skip if( prev == skip ) goto EXIT; mce_log(LL_DEVEL, "time skip: assume %"PRId64".%03"PRId64"s suspend", skip / 1000, skip % 1000); // notify in case some timers need re-evaluating execute_datapipe_output_triggers(&device_resumed_pipe, &prev, USE_INDATA); EXIT: return; }
/** Get monotonic timestamp not affected by system time / timezone changes * * @return milliseconds since some reference point in time */ static tick_t cka_tick_get_current(void) { return mce_lib_get_boot_tick(); }