Re: [PATCH] lib/timeutils: Add %s (seconds since the Epoch) to parse_timestamp()

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

 



On Tue, Sep 06, 2022 at 07:31:07PM +0300, Péter Ujfalusi wrote:
> On 06/09/2022 11:47, Karel Zak wrote:
> > On Tue, Sep 06, 2022 at 10:04:36AM +0300, Peter Ujfalusi wrote:
> >>  lib/timeutils.c | 8 ++++++++
> >>  1 file changed, 8 insertions(+)
> > 
> > Applied, thanks.
> 
> After some tinkering with a script where I needed this, would it make
> sense to change the way how one should be specifying seconds since the
> Epoch time to
> '@'<number>

Yes, '@' seems more readable. I have no strong opinion about it, maybe
we can support both convention (with and without @).

Anyway, we really need to add something like "INPUT TIMESTAMP" section
to the man page to describe supported formats.

> This would match how for example systemd.time requires it [1]
> 
> Basically I (or anyone) can use dmesg instead of journalctl in a script
> with the same --since=@<timestamp> parameter.
> 
> 'date +%s' prints out just a number.

It's possible to use --since=$(date +'@%s')

> If not, then I have made a rookie mistake with the patch, which should
> be fixed (discarding the seconds we got out from the timestamp).

Do you mean your copy & past tm.tm_sec = 0;? This should be fixed.

> /me hides

Come back and send a patch :-)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux