fix week adjustment
authorAlan Buxey <alan.buxey@gmail.com>
Mon, 9 May 2016 19:44:10 +0000 (20:44 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 9 May 2016 19:49:59 +0000 (15:49 -0400)
as proposed by dipixx

src/modules/rlm_sqlcounter/rlm_sqlcounter.c

index 063bbed..7fdcb3a 100644 (file)
@@ -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;