All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Ander Juaristi <a@juaristi.eus>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v8 2/2] meta: Introduce new conditions 'time', 'day' and 'hour'
Date: Wed, 21 Aug 2019 18:23:41 +0200	[thread overview]
Message-ID: <20190821162341.GB20113@breakpoint.cc> (raw)
In-Reply-To: <20190821151802.6849-2-a@juaristi.eus>

Ander Juaristi <a@juaristi.eus> wrote:
> These keywords introduce new checks for a timestamp, an absolute date (which is converted to a timestamp),
> an hour in the day (which is converted to the number of seconds since midnight) and a day of week.
> 
> When converting an ISO date (eg. 2019-06-06 17:00) to a timestamp,
> we need to substract it the GMT difference in seconds, that is, the value
> of the 'tm_gmtoff' field in the tm structure. This is because the kernel
> doesn't know about time zones. And hence the kernel manages different timestamps
> than those that are advertised in userspace when running, for instance, date +%s.
> 
> The same conversion needs to be done when converting hours (e.g 17:00) to seconds since midnight
> as well.
> 
> The result needs to be computed modulo 86400 in case GMT offset (difference in seconds from UTC)
> is negative.
> 
> We also introduce a new command line option (-t, --seconds) to show the actual
> timestamps when printing the values, rather than the ISO dates, or the hour.

Pablo, please see this "-t" option -- should be just re-use -n instead?

Other than this, this patch looks good and all tests pass for me.

  reply	other threads:[~2019-08-21 16:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 15:18 [PATCH nft v8 1/2] evaluate: New internal helper __expr_evaluate_range Ander Juaristi
2019-08-21 15:18 ` [PATCH nft v8 2/2] meta: Introduce new conditions 'time', 'day' and 'hour' Ander Juaristi
2019-08-21 16:23   ` Florian Westphal [this message]
2019-08-21 20:50     ` Pablo Neira Ayuso
2019-08-21 21:04       ` Florian Westphal
2019-08-23  7:08         ` Ander Juaristi
2019-08-23 12:39           ` Pablo Neira Ayuso
2019-08-24 14:07             ` Ander Juaristi

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=20190821162341.GB20113@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=a@juaristi.eus \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.