Using supercapacitor as backup for MCU
Assuming ideal conditions i.e. no leakage current in capacitor and other parts of circuit.

Case 1: Your micro controller is running and drawing 20 mA. Lets assume your micro controller will work fine till voltage reaches 4V. However for atmega 328, you can make it run at even lower voltages if you choose to run it at a lower clock frequency.

Assuming 20 mA at 5V, your load resistance will be 5V/0.02A = 250 ohms

Here is complete theory in one image:



Initial Vo = 5V and final Vc = 4V. Solving for time gives 225 seconds.

It means, your micro-controller will keep functioning for another 225 seconds after you lose power, provided the capacitor was charged to 5V.

Case 2: Your micro-controller is in power off mode consuming 200 uA.

R = 25000 ohms.

Solving for time gives 6.25 hours.

This is the theoretical max time you are getting. Things can't get better than this unless you are planning to run your controller at a lower clock frequency.

Just for you reference, Atmega328 can run from 1.8V. For this you get a time between 17 minutes and 28.33 hours

These are theoretical values. Practical values will be even lesser due to leakage in your diode, capacitor itself and other circuit elements.