How to run atmega328p at 8, 4 and 1 mhz?
If you run your MCU at 8 MHz, everything will run at this frequency: not
only the CPU core but also the timers, including Timer 0 which is used
for millis(), delay(), etc. So you will have to use a modified
version of the Arduino timing functions in order to cope with this clock
frequency.

Fortunately, such version already exists. Actually, it is even supported
by the standard Arduino core, since it supports the 3.3&nbsp;V version
of the Arduino Pro Mini, which uses an ATmega328P clocked at 8&nbsp;MHz.

I thus suggest you install an 8&nbsp;MHz crystal, burn in the bootloader
for the 3.3&nbsp;V Pro Mini, and tell your IDE that you are using that
board. In the Tools menu:


set board to "Arduino Pro or Pro Mini"
set processor to ""ATmega328P (3.3V, 8 MHz)"