You faced overflow issue. Since time tick function is 32 bit type, system couldn't generate next call time properly.
Is there any time tick function for 64 bit, then you can fix the issue.
Yes, if the timefunction back to 0, the next call time and current time would be corrupted.
Therefore, we are using 64bit time function.