linux-sysprog · beginner · ~15 min

Has the deadline passed?

Detect a timeout from timestamps.

Challenge

Implement int timed_out(long start, long now, long timeout) returning 1 if now - start >= timeout, else 0.

Starter code

int timed_out(long start, long now, long timeout) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.