Ejemplo n.º 1
0
/**
 * @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);
}
Ejemplo n.º 2
0
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);
}