From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754691AbbFLJcN (ORCPT ); Fri, 12 Jun 2015 05:32:13 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34474 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbbFLJcI (ORCPT ); Fri, 12 Jun 2015 05:32:08 -0400 Date: Fri, 12 Jun 2015 02:31:53 -0700 From: tip-bot for John Stultz Message-ID: Cc: john.stultz@linaro.org, linux-kernel@vger.kernel.org, bristot@redhat.com, hpa@zytor.com, tglx@linutronix.de, jbohac@suse.cz, prarit@redhat.com, mingo@kernel.org, richardcochran@gmail.com, jack@suse.cz Reply-To: tglx@linutronix.de, john.stultz@linaro.org, linux-kernel@vger.kernel.org, hpa@zytor.com, bristot@redhat.com, mingo@kernel.org, richardcochran@gmail.com, jack@suse.cz, jbohac@suse.cz, prarit@redhat.com In-Reply-To: <1434063297-28657-3-git-send-email-john.stultz@linaro.org> References: <1434063297-28657-3-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] ntp: Introduce and use SECS_PER_DAY macro instead of 86400 Git-Commit-ID: 90bf361ceae28dee50a584c3dd4c1a96178d982c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 90bf361ceae28dee50a584c3dd4c1a96178d982c Gitweb: http://git.kernel.org/tip/90bf361ceae28dee50a584c3dd4c1a96178d982c Author: John Stultz AuthorDate: Thu, 11 Jun 2015 15:54:54 -0700 Committer: Thomas Gleixner CommitDate: Fri, 12 Jun 2015 11:15:49 +0200 ntp: Introduce and use SECS_PER_DAY macro instead of 86400 Currently the leapsecond logic uses what looks like magic values. Improve this by defining SECS_PER_DAY and using that macro to make the logic more clear. Signed-off-by: John Stultz Cc: Prarit Bhargava Cc: Daniel Bristot de Oliveira Cc: Richard Cochran Cc: Jan Kara Cc: Jiri Bohac Cc: Ingo Molnar Link: http://lkml.kernel.org/r/1434063297-28657-3-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner --- kernel/time/ntp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7a68100..7aa2161 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -35,6 +35,7 @@ unsigned long tick_nsec; static u64 tick_length; static u64 tick_length_base; +#define SECS_PER_DAY 86400 #define MAX_TICKADJ 500LL /* usecs */ #define MAX_TICKADJ_SCALED \ (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) @@ -390,7 +391,7 @@ int second_overflow(unsigned long secs) case TIME_INS: if (!(time_status & STA_INS)) time_state = TIME_OK; - else if (secs % 86400 == 0) { + else if (secs % SECS_PER_DAY == 0) { leap = -1; time_state = TIME_OOP; printk(KERN_NOTICE @@ -400,7 +401,7 @@ int second_overflow(unsigned long secs) case TIME_DEL: if (!(time_status & STA_DEL)) time_state = TIME_OK; - else if ((secs + 1) % 86400 == 0) { + else if ((secs + 1) % SECS_PER_DAY == 0) { leap = 1; time_state = TIME_WAIT; printk(KERN_NOTICE