what effects millis() ?

The key is here tho:
previousMicros = previousMicros + duration;

The previousMicros variable does not hold the previous event time. It holds the next event time. Why use previous in the name when you mean next?