void getRecord(uint64_t oldTimestamp) { // you are using uint64_t here
int start = (oldTimestamp / (60 * 60 * 1000 * 24)) % 14; // you are using int here
You are likely running into an overflow issue, which is invoking undefined behavior.
You need to use uint64_t
as your start
type. The same goes for your currentTimestamp
and end
variables.