Reset millis();

aarg:
It is not possible to change the value of millis().

Of course it is possible. No need to lie about it, it's not like a secret or anything.

However, I do agree generally that it is unnecessary.

It comes in handy if you want, for example, to test your roll over handling without waiting 55 days or however long it takes for milliseconds() to roll.

I imagine a similar approach is available for micros().

This is a the example from the URL above w/ a little logic to show it working.

extern volatile unsigned long timer0_millis;
unsigned long new_value = 1000;

void setup(){
  Serial.begin(9600);
}

void loop(){

  Serial.print("millis = "); Serial.println(millis());

  if (millis() > 4000)
    setMillis(new_value);

  delay(333);
}

void setMillis(unsigned long new_millis){
  uint8_t oldSREG = SREG;
  cli();
  timer0_millis = new_millis;
  SREG = oldSREG;
}

HTH

a7