static unsigned long StartOfTimer = 0;
const unsigned long IntervalInMilliseconds = 5000; // 5 seconds
// When the interval starts:
StartOfTimer = millis();
// When you want to be sure the interval has expired:
if (millis() - StartOfTimer > IntervalInMilliseconds) {
// interval has passed
}