From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Heena Sirwani <heenasirwani@gmail.com>,
linux-kernel@vger.kernel.org, john.stultz@linaro.org
Subject: Re: [PATCH v2] timekeeping: Added a function to return tv_sec portion of ktime_get_real_ts64()
Date: Tue, 28 Oct 2014 16:50:01 +0100 [thread overview]
Message-ID: <3267270.TT2UKZmIpE@wuerfel> (raw)
In-Reply-To: <alpine.DEB.2.11.1410281641350.5308@nanos>
On Tuesday 28 October 2014 16:43:42 Thomas Gleixner wrote:
> >
> > +time64_t ktime_get_real_seconds(void)
> > +{
> > + time64_t seconds;
> > + struct timekeeper *tk = &tk_core.timekeeper;
> > + unsigned int seq;
> > +
> > + if (IS_ENABLED(CONFIG_64BIT))
> > + return tk->xtime_sec;
> > +
> > + do {
> > + seq = read_seqcount_begin(&tk_core.seq);
> > + seconds = tk->xtime_sec;
> > +
> > + } while (read_seqcount_retry(&tk_core.seq, seq));
> > +
> > + return seconds;
> > +}
> > +EXPORT_SYMBOL_GPL(ktime_get_real_seconds);
>
> Nice and clean implementation! Though I wonder whether we should just
> name it get_seconds64().
>
I don't have a strong opinion here, I suggested ktime_get_real_seconds()
for consistency with ktime_get_real_ts64(), but get_seconds64() would
make as much sense.
As I mentioned in my other reply, we have also concluded that returning
'unsigned long' from get_seconds() at the moment is actually not a
problem for y2038 because it will do the right until 2106 by returning
the unsigned lower 32-bit of the correct 64-bit number, so we might
not actually need this one.
I also don't have a strong opinion on this matter, adding it would
make it easier for developers to pick get_seconds64/ktime_get_real_ts64()
and understand that it's correct without having to know the finer
details of the time_t/ulong distinction.
Arnd
next prev parent reply other threads:[~2014-10-28 15:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 5:08 [PATCH v2] timekeeping: Added a function to return tv_sec portion of ktime_get_real_ts64() Heena Sirwani
2014-10-28 15:43 ` Thomas Gleixner
2014-10-28 15:50 ` Arnd Bergmann [this message]
2014-10-28 17:13 ` Thomas Gleixner
2014-10-28 19:54 ` Arnd Bergmann
2014-10-28 20:31 ` Thomas Gleixner
2014-10-28 20:35 ` Arnd Bergmann
2014-10-28 20:52 ` Thomas Gleixner
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=3267270.TT2UKZmIpE@wuerfel \
--to=arnd@arndb.de \
--cc=heenasirwani@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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