Non-Blocking Delay with Timestamps

Medium C Scheduling Asked at Tesla
Solve this problem

Replace a busy-wait delay with a non-blocking elapsed-time check so a cooperative scheduler can keep running other work.

Constraints

  • `int timer_expired(uint32_t start_ms, uint32_t interval_ms)` returns 1 once the interval has passed.
  • Must be correct across a 32-bit millisecond counter wrap.
  • Use the provided `uint32_t millis(void)`.
  • No blocking loops.
  • An interval of 0 must report expired immediately.
Starter codeC
1#include <stdint.h>2 3extern uint32_t millis(void);4 5int timer_expired(uint32_t start_ms, uint32_t interval_ms) {6    // TODO7    return 0;8}