Several solutions are possible:
There was a NIck Gammon who implemented the big number class which can also do very small numbers
Performance is traded for precision !
You could do the math right as it contains an error
total_amp_hours = total_amp_hours + current*(float(period/2160000000));
==> total_amp_hours = total_amp_hours + current * (1.0 * period)/2.16e9);
Add the amps per second in an intermediate variable and when a second has passed add its value to the amp_hour
total_amp_second += current * (1.0* period/2.16e9));
if (second has passed)
total_amp_hour += total_amp_second;
total_amp_second = 0.0;
2160000000 is the number of milliseconds in an hour.
In my days there were 3.600.000 milliseconds in an hour, but times seem to go fast in the internet era