Before: adjust and set time on boot, adjust rtc every hour, and on shutdown.
Now: do not set time on boot, adjust rtc on shutdown.

Rationale:

1) We can never ever set the systemtime after system is up and running, as this 
might
   make time go backwards (unless we are careful à la ntpd, but we don't want 
to get
   into that business).

2) We are under the assumption that exact time is not needed, we are just trying
   to avoid large, accumulating drifts over time. With the new (significantly 
simpler)
   implementation systemtime will be off by the drift since the last clean 
shutdown.
   With the old implementation systemtime would be off by the drift since last
   shutdown (even if it was unclean). Either way the drifts would not 
accumulate,
   and a clean reboot would get you a "perfect" time.

Signed-off-by: Tom Gundersen <[email protected]>
---
 Makefile |    3 +--
 adjtime  |   15 ---------------
 hwclock  |   23 +++++++----------------
 3 files changed, 8 insertions(+), 33 deletions(-)
 delete mode 100755 adjtime

diff --git a/Makefile b/Makefile
index fcabb0e..ff7d907 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 VER  := $(shell git describe)
-DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin 
/etc/bash_completion.d /usr/share/zsh/site-functions
+DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /sbin 
/etc/bash_completion.d /usr/share/zsh/site-functions
 
 minilogd: minilogd.o
 
@@ -9,7 +9,6 @@ installdirs:
 install: minilogd installdirs
        install -m644 -t $(DESTDIR)/etc inittab rc.conf
        install -m755 -t $(DESTDIR)/etc rc.local rc.local.shutdown rc.multi 
rc.shutdown rc.single rc.sysinit
-       install -m755 -t $(DESTDIR)/etc/cron.hourly adjtime
        install -m644 -t $(DESTDIR)/etc/rc.d functions
        install -m755 -t $(DESTDIR)/etc/rc.d hwclock network netfs
        install -m755 -t $(DESTDIR)/sbin minilogd rc.d
diff --git a/adjtime b/adjtime
deleted file mode 100755
index 6a825ca..0000000
--- a/adjtime
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# Update our hwclock for system drift
-
-. /etc/rc.conf
-
-HWCLOCK_PARAMS="--adjust"
-case $HARDWARECLOCK in
-    UTC) HWCLOCK_PARAMS+=" --utc";;
-    localtime) HWCLOCK_PARAMS+=" --localtime";;
-    *) HWCLOCK_PARAMS="";;
-esac
-
-if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then
-    hwclock $HWCLOCK_PARAMS
-fi
diff --git a/hwclock b/hwclock
index 117ab14..5996b95 100755
--- a/hwclock
+++ b/hwclock
@@ -11,27 +11,18 @@ esac
 
 case "$1" in
        start)
-               if [[ $HWCLOCK_PARAMS ]]; then
-                       status "Adjusting Hardware Clock" \
-                               hwclock --adjust
-                       stat_busy "Setting System Clock"
-                       hwclock --hctosys $HWCLOCK_PARAMS || stat_die
-                       stat_done
-                       # Note: This also enables /etc/cron.hourly/adjtime
-                       add_daemon hwclock
-               fi
-               ;;
+               add_daemon hwclock;;
        stop)
-               if [[ $HWCLOCK_PARAMS ]]; then
-                       stat_busy "Saving System Clock"
-                       hwclock --systohc $HWCLOCK_PARAMS || stat_die
-                       stat_done
-               fi
+               case $HARDWARECLOCK in
+                       UTC) hwclock --adjust --utc;;
+                       localtime) hwclock --adjust --localtime;;
+                       "") hwclock --adjust;;
+               esac
                rm_daemon hwclock
                ;;
        restart)
                $0 stop
-               sleep 1
+               sleep 2
                $0 start
                ;;
        *)
-- 
1.7.5.4

Reply via email to