Re: [PATCH nft v8 2/2] meta: Introduce new conditions 'time', 'day' and 'hour'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 21, 2019 at 06:23:41PM +0200, Florian Westphal wrote:
> Ander Juaristi <a@xxxxxxxxxxxx> 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.

this should be printed numerically with -n (global switch to disable
literal printing).

Then, -t could be added for disabling literal in a more fine grain, as
Phil suggest time ago with other existing options that are similar to
this one.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux