Race condition in AVR timers
Just make the retrieval atomic.

#include &lt;util/atomic.h&gt;

 ...

uint64_t time_us(){
    register uint8_t tcnt2
    register uint64_t ovcnt;
    ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
    {
        tcnt2 = TCNT2;
        ovcnt = _time_overflow_cnt;
    }
    return (ovcnt*256 + tcnt2)/(F_CPU/8/1000000ULL);
}