Wrong sign in if condition

if (-this_delay_ms < -state->timelapse/2), -this_delay_ms is always positive,
and -state->timelapse/2 is negative, so this if is never true.  The if
condition should be if (-this_delay_ms < state->timelapse/2).