From: Alan Buxey Date: Mon, 9 May 2016 19:44:10 +0000 (+0100) Subject: fix week adjustment X-Git-Tag: release_3_0_12~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32a6ee4a4328a43f43adcaf92e645e3f2b382902;p=thirdparty%2Ffreeradius-server.git fix week adjustment as proposed by dipixx --- diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index 063bbedec8f..7fdcb3a23ca 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -217,7 +217,7 @@ static int find_prev_reset(rlm_sqlcounter_t *inst, time_t timeval) * Round down to the prev nearest week. */ tm->tm_hour = 0; - tm->tm_mday -= (7 - tm->tm_wday) +(7*(num-1)); + tm->tm_mday -= tm->tm_wday +(7*(num-1)); inst->last_reset = mktime(tm); } else if (strcmp(inst->reset, "monthly") == 0 || last == 'm') { tm->tm_hour = 0;