ソースを参照

core: utils/tmrec - reworked bymonth matching for negative indexes

- GH #4214

(cherry picked from commit 2081b3aac394223b68b849fbac2a9e5ac4392334)
Daniel-Constantin Mierla 4 ヶ月 前
コミット
4c96282bdf
1 ファイル変更7 行追加4 行削除
  1. 7 4
      src/core/utils/tmrec.c

+ 7 - 4
src/core/utils/tmrec.c

@@ -1104,6 +1104,7 @@ int check_min_unit(tmrec_t *_trp, ac_tm_t *_atp, tr_res_t *_tsw)
 int check_byxxx(tmrec_t *_trp, ac_tm_t *_atp)
 {
 	int i;
+	int v;
 	ac_maxval_t *_amp = NULL;
 	if(!_trp || !_atp)
 		return REC_ERR;
@@ -1117,10 +1118,12 @@ int check_byxxx(tmrec_t *_trp, ac_tm_t *_atp)
 
 	if(_trp->bymonth) {
 		for(i = 0; i < _trp->bymonth->nr; i++) {
-			if(_atp->t.tm_mon
-					== ((_trp->bymonth->xxx[i] - 1) * _trp->bymonth->req[i]
-							   + 12)
-							   % 12)
+			if(_trp->bymonth->req[i] < 0) {
+				v = 12 - _trp->bymonth->xxx[i];
+			} else {
+				v = _trp->bymonth->xxx[i] - 1;
+			}
+			if(_atp->t.tm_mon == v)
 				break;
 		}
 		if(i >= _trp->bymonth->nr)