/** * @brief Returns the max duration for which the system cannot suspend due to an activity * * @param now * * @retval Duration * */ long PwrEventActivityGetMaxDuration(struct timespec *now) { Activity *a = _activity_obtain_max(now); if (!a) return 0; struct timespec diff; ClockDiff(&diff, &a->end_time, now); return ClockGetMs(&diff); }
static void test_ClockGetMs_validate(long sec, long nsec) { struct timespec ts; ts.tv_sec = sec; ts.tv_nsec = nsec; long long reference = ((sec * NSEC_PER_SEC) + nsec) / NSEC_PER_MSEC; long milliseconds = ClockGetMs(&ts); g_assert(milliseconds == reference); }