attachInterrupt question

The reference for attachInterrupt says that

Inside the attached function ........................the value returned by millis() will not increment.

Can someone please explain what this means? I want to record the time (millis()) when the interrupt occurs.

Can someone please explain what this means?

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
}

Thank you, I understand now. That will work for me as my ISR is very short, so the error in timing will be acceptable in my app.

So volatile declares the variable as global, so that it can be written and read anywhere in the program?

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.

yendis:
So volatile declares the variable as global, so that it can be written and read anywhere in the program?

No. More on volatile here.