summaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2015-06-11 15:54:54 -0700
committerThomas Gleixner <tglx@linutronix.de>2015-06-12 11:15:49 +0200
commit90bf361ceae28dee50a584c3dd4c1a96178d982c (patch)
tree159e22aa66e55580668b380678dc1966225be2cd /kernel/time
parentd151832650ed98961a5650e73e85c349ad7839cb (diff)
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 <john.stultz@linaro.org> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Jan Kara <jack@suse.cz> Cc: Jiri Bohac <jbohac@suse.cz> Cc: Ingo Molnar <mingo@kernel.org> Link: http://lkml.kernel.org/r/1434063297-28657-3-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/ntp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 7a681003001c..7aa216188450 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