Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] lib/timeutils: Add %s (seconds since the Epoch) to parse_timestamp()
Date: Thu, 8 Sep 2022 12:29:17 +0300	[thread overview]
Message-ID: <613a861f-7af9-df43-9863-dd869bcef9e0@linux.intel.com> (raw)
In-Reply-To: <20220907072048.5buz33o2df5cvdiw@ws.net.home>



On 07/09/2022 10:20, Karel Zak wrote:
> 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 :-)

I have sent a fix patch which requires @ as a prefix and keeps the
seconds intact:
https://lore.kernel.org/util-linux/20220907054141.15608-1-peter.ujfalusi@linux.intel.com/T/#u

-- 
Péter

      parent reply	other threads:[~2022-09-08  9:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  7:04 [PATCH] lib/timeutils: Add %s (seconds since the Epoch) to parse_timestamp() Peter Ujfalusi
2022-09-06  8:47 ` Karel Zak
2022-09-06 16:31   ` Péter Ujfalusi
2022-09-07  7:20     ` Karel Zak
2022-09-07 12:57       ` Dmitry V. Levin
2022-09-08  9:29       ` Péter Ujfalusi [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=613a861f-7af9-df43-9863-dd869bcef9e0@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@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 read-only IMAP folder(s) and NNTP newsgroup(s).