Using Arduino As a Counter

Thank you for your advice and explanation of the logic on how it works.

Realtime clock is preferred and I do not have any preference on how fast it writes to the SD card.