You are very close. The average power is a very accurate way to do this given that you are not pulling such a high current that the effective capacity of the battery fluctuates.
Batteries, Batteries, and More Batteries
There is one very important term, and that is the self discharge rate of the battery. This is dependent on chemistry, but lets say you get a nickel-metal hydride. The self discharge rate is
"20% or more in first 24 hours, plus 4% per day thereafter" if it is not a
low self discharge rate NiMH, which still discharges around 25 or so % a year.
Lithium batteries have some of the best characteristics for self discharge rate and my experience supports this fact. I think battery university has a great site to discuss many different battery characteristics and I often point people there to learn about batteries when they are starting to work with them. If you want to compare battery discharge rates they have an entire article discussing the phenomena.
This is a bit around the point, but I always try to make this point, when you measure battery voltage you need to have it under load. This varies with chemistry, but it is paramount in lithiums. I had a coworker placing bad coin cells in our devices and using them because the coin cells showed almost full voltage with no load. Under a load of any amount(10kohm aprox .2mA) they were flat dead.
Your Microcontroller and You
As you are dealing with using the manufacturer sheet on leakage current there are also many different issues you will have to deal with to keep to those specs that are probably also work thinking about. The biggest I have seen is a floating input. Many engineers will leave unused pins as inputs thinking, "Hey, what harm can this do?" Quite a bit if you are talking microamps. A floating input will have its transistors changing state constantly and the fluctuations cause a power draw difference. We once had a reduced lifetime in a product because we had an error that left 2 pins floating causing our standby current to more then double on our MSP430. You need to drive all of your pins to output and let them hold a state.
It is easy to miss when doing these calculations things like wakeup time. I seem to remember our MSP430 had a non-negligible wakeup time if you were doing it very often. It also had a larger power pulse for just a moment as it came online. Our little homespun RTOS had to try to take this into account and if the shutdown was less then X milliseconds we skipped it with NOPs and saved some power.
If you are looking at a very long life product, you are going to need conformal coating. The oils in your skin are not an issue immediately, but with time they form a lightly conductive material on your board. Conformal coating protects your board from this little current sucking side affect.
Read any app notes they have about low power operation, it probably covers issues like the pins need to be held as output and many other important and useful facts.
Last but not least, Dont let yourself get relaxed just because you have read the app notes and everything seems okay after a week of running your product, you have to do as clabacchio says, you must measure and make sure. You debug your code normally, this is part of it, you need to find out if you made a mistake that is causing your idle current to be mAs instead of uA or even just if you did what we did and a pin is floating on accident. Make sure you use buffered measurements when you do this, if you have a large leakage on your device taking the data you can make a mountain out of a molehill when testing. Also, never forget about pullups, they are little power hogs if you are not careful.
First, the annual solar irradiance is calculated by taking the power incident on a square meter when perpendicular to the sun, and multiplying by 24 hours and then by 365 days. Since the irradiance is typically about 1.366 kW/sq m, when you multiply it out you get 11.9 kW-hr/sq m, which is your number.
But you might have noticed a problem. This assumes the sun is shining 24 hours per day, which is hardly proper.
Second, your second calculation also assumes 24 hours per day sunlight, which is not right. Since the average length of day is about 12 hours, your 25.6 Wh should be divided by 2, giving 12.8 Wh per day.
Finally, this number tells you how much power is falling on the solar cell, not how much the cell puts out. It also assumes the cell will be perpendicular to the sun at all times, and that the atmosphere does not attenuate sunlight. The first may be true, the second is not. Consider that the sun is much dimmer at sunset than at noon.
Let's take the case of noon sunlight. Assuming the air is very clear and you are getting the nominal irradiance, the power falling on the cell will be 1366 w/sq m x .0078, or about 10 watts. Since you have a solar cell rated for 1 watt, this says that you can assume the cell has an efficiency of about 10%, which is about right.
For a 1-watt solar cell which is fixed in position, and is perpendicular to the sun at noon, you can figure on a total output of 4-6 Wh on a clear day. On the one hand, as the sun moves away from the noon position, the effective area decreases (reaching zero at sunrise and sunset when the cell is edge-on to the sun). Also, sunlight gets attenuated by the atmosphere at lower angles, and finally the cells themselves will typically become less efficient at lower intensities.
Best Answer
If \$P(t)=v(t)\cdot i(t)\$ is the power, then the energy is
\$ E(t) = \int P(t)\,dt = \int v(t)\cdot i(t)\,dt \$
The method that you apply is an approximation to the exact energy calculation.It depends on the accuracy you want in your results, if it helps or not.
If you look at integrating, it is formed by the product of voltage and current multiplied by \$dt\$. The time differential is an infinitesimal increase.
In your case, the time between samples are not infinitesimal, so you can expect an error on the value of energy calculated. If the interval between measurements is kept uniform, you are using the rectangular approximation to the solution of the integral. You should evaluate whether the results you get with the generated error is acceptable.