if (now + prd < *t) *t = 0; // Time wrapped? Reset timer
if (*t == 0) *t = now + prd; // First poll? Set expiration
Wouldn't resetting the expiration obstruct the timing of the task currently being timed? It could add a delay up to two times the period based on my back-of-the-envelope calculations. Is this acceptable in the grand-scheme of things? What if we need precise millisecond timing, is it better to add checks within the ISR itself?
Thank you.