netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Re: xt_time 2007-09-22
Date: Sun, 23 Sep 2007 18:20:44 +0200	[thread overview]
Message-ID: <46F6925C.3000909@trash.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0709231729310.15712@fbirervta.pbzchgretzou.qr>

Jan Engelhardt wrote:
> On Sep 23 2007 17:05, Patrick McHardy wrote:
> 
>>>+	localtime_2(&current_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(&current_time, stamp);
> 	if (!(info->weekdays_match & (1 << current_time.weekday)))
> 		return false;
> 	if (info->monthdays_match != XT_TIME_ALL_MONTHDAYS) {
> 		localtime_3(&current_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.

      reply	other threads:[~2007-09-23 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-22 11:26 xt_time 2007-09-22 Jan Engelhardt
2007-09-22 11:28 ` xt_time 2007-09-22 (iptables) Jan Engelhardt
2007-09-23 15:08   ` Patrick McHardy
2007-09-22 15:19 ` xt_time 2007-09-22 Patrick McHardy
2007-09-22 15:38   ` Jan Engelhardt
2007-09-22 15:39     ` Patrick McHardy
2007-09-22 15:47       ` Jan Engelhardt
2007-09-22 15:58     ` Jan Engelhardt
2007-09-23 15:05       ` Patrick McHardy
2007-09-23 15:32         ` Jan Engelhardt
2007-09-23 16:20           ` Patrick McHardy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46F6925C.3000909@trash.net \
    --to=kaber@trash.net \
    --cc=jengelh@computergmbh.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).