From: Miroslav Lichvar <mlichvar@redhat.com>
To: Justin Keller <justincompsci@gmail.com>
Cc: linux-kernel@vger.kernel.org,
John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Prarit Bhargava <prarit@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [RFC][PATCH] timekeeping: Limit system time to prevent 32-bit time_t overflow
Date: Thu, 16 Apr 2015 09:56:33 +0200 [thread overview]
Message-ID: <20150416075633.GA7968@localhost> (raw)
In-Reply-To: <CALah4Nen4xEO0DWGvEi6aVJVPyeqhYDutt5cpPAxp49r6SJSYA@mail.gmail.com>
On Wed, Apr 15, 2015 at 12:17:36PM -0400, Justin Keller wrote:
> Is there a reason for "step = leap"?
It's there to not change the behavior when a leap second occurs, the
clock still needs to be stepped. I guess it could be optimized a bit,
if it used "if (unlikely(leap || tk->xtime_sec >= time_max_sec))", the
64-bit step variable wouldn't have to be used in normal operation.
> > /* Figure out if its a leap sec and apply if needed */
> > leap = second_overflow(tk->xtime_sec);
> > - if (unlikely(leap)) {
> > + step = leap;
> > +
> > + /* If the system time reached the maximum, step it back */
> > + if (unlikely(tk->xtime_sec >= time_max_sec)) {
> > + step = time_max_sec - tk->xtime_sec - SEC_PER_WEEK;
> > + printk(KERN_NOTICE
> > + "Clock: maximum time reached, stepping back\n");
> > + }
> > +
> > + if (unlikely(step)) {
> > struct timespec64 ts;
> >
> > - tk->xtime_sec += leap;
> > + tk->xtime_sec += step;
--
Miroslav Lichvar
next prev parent reply other threads:[~2015-04-16 7:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 16:45 Preventing 32-bit time_t overflow Miroslav Lichvar
2015-04-09 17:05 ` John Stultz
2015-04-15 15:41 ` [RFC][PATCH] timekeeping: Limit system time to prevent " Miroslav Lichvar
2015-04-15 16:02 ` Arnd Bergmann
2015-04-15 16:17 ` Justin Keller
2015-04-16 7:56 ` Miroslav Lichvar [this message]
2015-04-15 21:31 ` One Thousand Gnomes
2015-04-16 7:54 ` Miroslav Lichvar
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=20150416075633.GA7968@localhost \
--to=mlichvar@redhat.com \
--cc=arnd@arndb.de \
--cc=john.stultz@linaro.org \
--cc=justincompsci@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.