Function to time capacitor charging (through a resistance).

The time can be used to estimate the resistance.