rem: DBG("3\n");
context: int check_tmrec(tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw){	DBG("1\n****** time=%d  start=%d  duration=%d\n",_atp->time,_trp->dtstart,			_trp->duration);	if(!_trp || !_atp || (!_IS_SET(_trp->duration) && !_IS_SET(_trp->dtend)))		return REC_ERR;	DBG("2\n");	DBG("****** time=%d  start=%d\n",_atp->time,_trp->dtstart);	// it is before start date	if(_atp->time < _trp->dtstart)		return REC_NOMATCH;	DBG("3\n");	// compute the duration of the reccurence interval	if(!_IS_SET(_trp->duration))		_trp->duration = _trp->dtend - _trp->dtstart;	DBG("****** time=%d  start=%d  duration=%d\n",_atp->time,_trp->dtstart,		_trp->duration);	if(_atp->time <= _trp->dtstart+_trp->duration)	{		if(_tsw)		{			if(_tsw->flag & TSW_RSET)			{				if(_tsw->rest>_trp->dtstart+_trp->duration-_atp->time)					_tsw->rest = _trp->dtstart+_trp->duration - _atp->time;			}			else			{				_tsw->flag |= TSW_RSET;				_tsw->rest = _trp->dtstart+_trp->duration - _atp->time;			}		}		return REC_MATCH;	}		// after the bound of recurrence	if(_IS_SET(_trp->until) && _atp->time >= _trp->until + _trp->duration)		return REC_NOMATCH;		// check if the instance of recurence matches the 'interval'	if(check_freq_interval(_trp, _atp)!=REC_MATCH)		return REC_NOMATCH;	if(check_min_unit(_trp, _atp, _tsw)!=REC_MATCH)		return REC_NOMATCH;	if(check_byxxx(_trp, _atp)!=REC_MATCH)		return REC_NOMATCH;	return REC_MATCH;}