In most sleep modes, millis() will not run.
Otherwise, simply store how many milliseconds have passed when the pause is pressed, and correct for that number when it's running again.
I have been reading about sleep modes and it seems that Idle would be perfect for my scope since it allows to wake the uC up even from I/O and ADC pins. Can you confirm that it could be suitable for my idea? Currently the Pause/resume button is connected with other buttons, via a voltage divider, to pin A2
This sounds like a nice project using a RTC (Real Time Clock) that you do not have to set an absolute time is not important but time passing is. Set it up using Unix time and the math is all integer. The accuracy even on the cheapest should be way more then you need. A broken analog clock is correct twice a day in the US once a day in some other places. Side benefit many have battery backed RAM but you also have flash.
Good Luck & Have Fun!
AFAIK there are production washing machines here in Europe which do use RTCs to show the cycle start and finish time. But perhaps it's a bit overkill
You have completely confused and muddled yourself!
This machine is operating from mains power - there is no reason whatsoever to use a "sleep" mode; that is only ever for power saving.
When you pause it, you note the millis() value and you know the value when that cycle started, so you calculate how much time it has been operating. You also know how much time the cycle was to have taken.
When you restart, you set the new time of completion according to the desired cycle time minus the time already served. It's just maths.
And for a washing machine, you do not need a RTC! The accuracy of millis() will be just fine!
I had already thought about a solution like yours and I came to the conclusion that it was not possible. You may ask why. The reason is that heating and fill are NOT time based. The pressure switch calls for more water if the clothes are absorbing too much. More water means more time to heat it. And so on. A cycle run in two different conditions will never last equally as long beacuse of the tempearture of the water coming in, the difficulty with which the machine balances the load before the spin cycle, the temperature set (40,50,60°C). There's too many variables to do something that way
The reason I'd use sleep() is to, indeed, pause millis() from continuing to flow
This definitely is the simplest solution for the timing.
Mission impossible? XY problem?
I think that you should explain the possible reasons for pausing. Then pausing can be disallowed or truncated depending on the current state. Also the temperature profile could be continued without interruption, only machine motion (and water filling?) may be stoppable for some time.
I could, for example, decide to pause the program in order to open the door and add or remove clothes, to avoid the machine to heat when I'm already using other energy consuming devices or to simply let clothes soak in warm soapy water.
If sleep is suitable for what I want to do then it'd be perfect to have it stop millis()