Here is a script you can use. Save it as the file $HOME/bin/leap-second.sh
Code:
#!/bin/bash
#: Title : leap-second.sh
#: Date Created: Sun Jul 1 17:35:00 CDT 2012
#: Last Edit : Mon Jul 2 11:38:56 CDT 2012
#: Author : Sheeri K. Cabral
#: Version : 1.00
#: Description :
#: Options :
#
# Check to see if we are root ************************************************
#
if [[ $UID -ne 0 ]]; then
clear
id -Gn | grep -q wheel || echo "Root User Permissions are required, Please Enter the ..."
echo
sudo $0 $@
Exit_Code=$?
exit $Exit_Code
else
clear
fi
# this is a quick-fix to the 6/30/12 leap second bug
if [ ! -f /tmp/leapsecond_2012_06_30 ] ; then
/etc/init.d/ntpd stop; date -s "`date`" && /bin/touch /tmp/leapsecond_2012_06_30
fi
exit 0
# End Of Script
Then use the this terminal command to mark it executable: chmod +x $HOME/bin/leap-second.sh
When run, it will ask for the root user password if you are not root. According to the LKML article, you could just run the the terminal command: date -s "`date`", but then proceeds to post a patch file as follows:
Code:
@@ -942,7 +942,7 @@ static void timekeeping_adjust(s64 offset)
*
* Returns the unconsumed cycles.
*/
-static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
+static cycle_t logarithmic_accumulation(cycle_t offset, int shift, int* clockset)
{
u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;
u64 raw_nsecs;
@@ -963,6 +963,8 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
+ if (leap)
+ *clockset = 1;
}
/* Accumulate raw time */
@@ -994,6 +996,7 @@ static void update_wall_time(void)
struct clocksource *clock;
cycle_t offset;
int shift = 0, maxshift;
+ int clockset = 0;
unsigned long flags;
write_seqlock_irqsave(&timekeeper.lock, flags);
@@ -1026,7 +1029,7 @@ static void update_wall_time(void)
maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1;
shift = min(shift, maxshift);
while (offset >= timekeeper.cycle_interval) {
- offset = logarithmic_accumulation(offset, shift);
+ offset = logarithmic_accumulation(offset, shift, &clockset);
if(offset < timekeeper.cycle_interval<<shift)
shift--;
}
@@ -1079,6 +1082,8 @@ static void update_wall_time(void)
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
+ if (leap)
+ clockset = 1;
}
timekeeping_update(false);
@@ -1086,6 +1091,8 @@ static void update_wall_time(void)
out:
write_sequnlock_irqrestore(&timekeeper.lock, flags);
+ if (clockset)
+ clock_was_set();
}
/**
--
1.7.9.5
I presume this patches the kernel source file though I was unable to gleam the intended kernel version or if it matters. As always, I come up short on the exact method to apply such a kernel patch. I wonder when the next time a leap second will even be needed again? I think I would just patch the kernel source files for active kernel versions and see what happens next time around.
Thank You,
Bookmarks