you'll need to make that based on the time between receiving rather than the timestamps or the bots will send them in a second with 5 seconds later on the timestamp and same problem again
Discussion
Oooohh That's probably it.
self declared timestamps are always lies, and so many algorithms tolerate quite wide variance, you need a time skew detection to really get that right which is a several seconds long process of sending timestamps back and forward until you get a stable average
the verge cryptocurrency ran into a huge problem that enabled the first real world timewarp attack due to a network time consensus
i'm pretty sure satoshi said something about how timestamps can't be trusted but you also have to draw a line somewhere, i think bitcoin block timestamps are allowed to be as much as an hour out of order, but legit timestamps should really never vary more than about 12 seconds