From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: Re: xt_time 2007-09-22 Date: Sun, 23 Sep 2007 18:20:44 +0200 Message-ID: <46F6925C.3000909@trash.net> References: <46F53283.90204@trash.net> <46F680B7.4000907@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: Netfilter Developer Mailing List To: Jan Engelhardt Return-path: Received: from stinky.trash.net ([213.144.137.162]:49677 "EHLO stinky.trash.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753736AbXIWQ30 (ORCPT ); Sun, 23 Sep 2007 12:29:26 -0400 In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org List-Id: netfilter-devel.vger.kernel.org Jan Engelhardt wrote: > On Sep 23 2007 17:05, Patrick McHardy wrote: > >>>+ localtime_2(¤t_time, stamp); >>>+ >>>+ if (!(info->weekdays_match & (1 << current_time.weekday))) >>>+ return false; >> >>Shouldn't this do the same optimization as below? > > > No, it's not worth it. localtime_3 requires that localtime_2 be run > before, so it would look like: > > if (info->weekdays_match != XT_TIME_ALL_WEEKDAYS && > info->monthdays_match != XT_TIME_ALL_MONTHDAYS) { > localtime_2(¤t_time, stamp); > if (!(info->weekdays_match & (1 << current_time.weekday))) > return false; > if (info->monthdays_match != XT_TIME_ALL_MONTHDAYS) { > localtime_3(¤t_time, stamp); > if (!(info->monthdays_match & (1 << current_time.monthday))) > return false; > } > } > > Since localtime_2() is miniscule, all this if'ing does not improve > things at all. OK, thanks for the explanation.