Lines 424-435
int findNeedRotating(logInfo * log, int
Link Here
|
424 |
switch (log->criterium) { |
424 |
switch (log->criterium) { |
425 |
case ROT_WEEKLY: |
425 |
case ROT_WEEKLY: |
426 |
/* rotate if: |
426 |
/* rotate if: |
427 |
1) the current weekday is before the weekday of the |
427 |
1) the day of the week is the same as the day of the week of |
428 |
last rotation |
428 |
the previous rotation but not the same day of the year |
|
|
429 |
this will rotate it on the same day every week, but not |
430 |
twice a day. |
429 |
2) more then a week has passed since the last |
431 |
2) more then a week has passed since the last |
430 |
rotation */ |
432 |
rotation */ |
431 |
state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) || |
433 |
state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday && |
432 |
((mktime(&now) - mktime(&state->lastRotated)) > |
434 |
now.tm_yday != state->lastRotated.tm_yday) || |
|
|
435 |
((mktime(&now) - mktime(&state->lastRotated)) > |
433 |
(7 * 24 * 3600))); |
436 |
(7 * 24 * 3600))); |
434 |
break; |
437 |
break; |
435 |
case ROT_MONTHLY: |
438 |
case ROT_MONTHLY: |