How accurate are delays within loops

Ben1234:
I am trying to store a value 40 to EEPROM times a second so the value will be stored every 25ms. If I put a 25ms delay in the loop then it delays 25ms, but takes time to run the rest of the loop so the time will actually be more than 25ms for the loop to run. Does anyone know how long that additional time will be? Is there a function that I can use to test the time? The number of samples a minute is flexible, but I need to know as accurately as possible how long that extra time will be. Thanks

Setting aside the issue of killing the EEPROM, you can avoid the processing delay issue you mention if you code the time comparison correctly:

unsigned long lastTime;
const unsigned long interval = 25; // ms

...

if(millis() - lastTime > interval)
{
    // ... do stuff
    lastTime += interval;
}

The crucial part here is that you update lastTime to record when the event was due, not when your sketch handled it. This means the timing doesn't slip by however long it took your sketch to notice that the interval had elapsed.