From: Denis Kenzior <denkenz@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, ell@lists.linux.dev
Subject: Re: [PATCH] timeout: add l_timeout_get_remaining
Date: Wed, 28 Aug 2024 14:10:49 -0500 [thread overview]
Message-ID: <d9d4662c-42ce-441b-a623-e2bdae4c5a3b@gmail.com> (raw)
In-Reply-To: <20240828164341.875578-1-prestwoj@gmail.com>
Hi James,
> +LIB_EXPORT bool l_timeout_get_remaining(struct l_timeout *timeout,
> + uint64_t *remaining)
Lets call this l_timeout_remaining()
> +{
> + struct itimerspec current;
> +
> + if (unlikely(!timeout))
> + return false;
> +
> + if (timerfd_gettime(timeout->fd, ¤t) < 0)
> + return false;
> +
> + if (remaining)
> + *remaining = current.it_value.tv_sec * L_USEC_PER_SEC +
> + current.it_value.tv_nsec / L_NSEC_PER_USEC;
Can we use _time_from_timespec? Or maybe add that to time-private.h?
> +
> + return true;
> +}
Regards,
-Denis
prev parent reply other threads:[~2024-08-28 19:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 16:43 [PATCH] timeout: add l_timeout_get_remaining James Prestwood
2024-08-28 19:10 ` Denis Kenzior [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=d9d4662c-42ce-441b-a623-e2bdae4c5a3b@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.linux.dev \
--cc=prestwoj@gmail.com \
/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