From: Alan T. DeKok Date: Wed, 8 Sep 2021 12:35:58 +0000 (-0400) Subject: use fr_time(), which doesn't jump around when NTP changes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e66b04f7d3605edff9fb615dc5e5fc8c471b9bb6;p=thirdparty%2Ffreeradius-server.git use fr_time(), which doesn't jump around when NTP changes --- diff --git a/src/lib/server/log.h b/src/lib/server/log.h index f6488ca36ae..1eef10dc183 100644 --- a/src/lib/server/log.h +++ b/src/lib/server/log.h @@ -521,8 +521,8 @@ do {\ * */ typedef struct { - time_t now; //!< Current time - Here because it avoids repeated stack allocation. - time_t last_complained; //!< Last time we emitted a log message. + fr_time_t now; //!< Current time - Here because it avoids repeated stack allocation. + fr_time_t last_complained; //!< Last time we emitted a log message. unsigned int repeated; //!< Number of "skipped" messages. } fr_rate_limit_t; @@ -545,7 +545,7 @@ typedef struct { #define RATE_LIMIT_LOCAL(_entry, _log, _fmt, ...) \ do {\ if (fr_rate_limit_enabled()) {\ - (_entry)->now = time(NULL);\ + (_entry)->now = fr_time();\ if ((_entry)->now != (_entry)->last_complained) {\ (_entry)->last_complained = (_entry)->now;\ if (((_entry)->repeated > 0) && (((_entry)->now - (_entry)->last_complained) == 1)) { \ @@ -582,7 +582,7 @@ do {\ #define RATE_LIMIT_LOCAL_ROPTIONAL(_entry, _l_request, _l_global, _fmt, ...) \ do {\ if (fr_rate_limit_enabled()) {\ - (_entry)->now = time(NULL);\ + (_entry)->now = fr_time();\ if ((_entry)->now != (_entry)->last_complained) {\ (_entry)->last_complained = (_entry)->now;\ if (((_entry)->repeated > 0) && (((_entry)->now - (_entry)->last_complained) == 1)) { \