summaryrefslogtreecommitdiffstats
path: root/source/n/ntp/rc.ntpd
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/ntp/rc.ntpd')
-rw-r--r--source/n/ntp/rc.ntpd15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/n/ntp/rc.ntpd b/source/n/ntp/rc.ntpd
index 7cf3d50b0..c1d1411ca 100644
--- a/source/n/ntp/rc.ntpd
+++ b/source/n/ntp/rc.ntpd
@@ -7,6 +7,21 @@ ntpd_start() {
echo -n "Starting NTP daemon: $CMDLINE"
$CMDLINE -p /var/run/ntpd.pid
echo
+ # The kernel is now mocking around with the the hardware clock if
+ # ntpd is running, so if the hardware clock (wall clock) is set to
+ # 'localtime' execute hwclock --localtime --systohc to disable the
+ # 11 minute mode kernel function:
+ if [ -x /sbin/hwclock ]; then
+ # Check for a broken motherboard RTC clock (where ioports for rtc are
+ # unknown) to prevent hwclock causing a hang:
+ if ! grep -q -w rtc /proc/ioports ; then
+ CLOCK_OPT="--directisa"
+ fi
+ if ! grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
+ echo "Saving system time to the hardware clock (localtime)."
+ /sbin/hwclock $CLOCK_OPT --localtime --systohc
+ fi
+ fi
}
# Stop ntpd: