clientlog: save time of last hit with sub-second resolution

Instead of time_t use a 32-bit fixed point representation with 4-bit
fraction to save the time of the last hit. The rate can now be measured
up to 16 packets per second. Maximum interval between hits is about 4
years.
This commit is contained in:
Miroslav Lichvar
2015-12-02 17:49:40 +01:00
parent 98947a4e52
commit d3096c3b5e
4 changed files with 90 additions and 34 deletions

View File

@@ -1686,7 +1686,7 @@ NCR_ProcessUnknown
return;
}
log_index = CLG_LogNTPAccess(&remote_addr->ip_addr, now->tv_sec);
log_index = CLG_LogNTPAccess(&remote_addr->ip_addr, now);
/* Don't reply to all requests if the rate is excessive */
if (log_index >= 0 && CLG_LimitNTPResponseRate(log_index)) {