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