The millis() function returns the time since the Arduino was reset, which relies on clock tick interrupts to be updated. Those don't happen, nor do any other interrupts, while your ISR is running.
I want to record the time (millis()) when the interrupt occurs.
You can do that. What you can NOT do is wait around in an ISR until millis() has incremented some amount.
you certainly may record the current return of millis() during an interrupt.... millis() will not ADVANCE during the ISR, however....
void myISR()
{
myGlobalEventFlag = true; // <<<<<<<< should be declared volatile
myGlobalUnsignedLong = millis(); // <<<<<<<< should also be declared volatile
}
yendis:
So volatile declares the variable as global, so that it can be written and read anywhere in the program?
No. It forces the compiler to keep memory contents updated, because otherwise some calculation results remain only in CPU registers due to register usage optimization.