Time comparisons are difficult. Or not.

This commit is contained in:
Ignotus Peverell 2018-11-08 00:40:28 +00:00
parent f7d0fe1840
commit e9c50ccb56
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211

View file

@ -39,7 +39,7 @@ impl RateCounter {
let now_millis = millis_since_epoch();
self.last_min_times.push(now_millis);
self.last_min_bytes.push(bytes);
while self.last_min_times.len() > 0 && self.last_min_times[0] > now_millis + 60000 {
while self.last_min_times.len() > 0 && self.last_min_times[0] + 60000 < now_millis {
self.last_min_times.remove(0);
self.last_min_bytes.remove(0);
}