Fix potential timedata overflow
Summary:
The add before division can potentially cause an overflow.
If we divide before adding, no overflow can occur.
Test Plan: ninja check
Reviewers: #bitcoin_abc, Fabien, deadalnix
Reviewed By: #bitcoin_abc, Fabien, deadalnix
Subscribers: deadalnix, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D6025