Best method for timing?

Other than using a library, or interrupts, which would be better?

if (millis() % 400 == 0)

or

if (millis() - last > 400)

Thanks!

I would say the last method.

You can't be sure the program executes the "if (millis() % 400 == 0) " at the exact millisecond, depending on the program (maybe a short one). It might skip one or more periods.

The former also relies on division (slow). The 2nd option should be faster.