[arch-projects] [PATCH 1/2] hwclock: allow TZ to be set in adjtime, only adjust for TZ during boot

Tom Gundersen teg at jklm.no
Sun Jun 5 16:19:58 EDT 2011

This allows HARDWARECLOCK to be removed from rc.conf, if you want to
rely on /var/lib/hwclock/adjtime (or wherever the file ends up in the
future). It assumes the relevant path is on the rootfs.

Furthermore, we can assume (since kernel2.6.??) that the rtc modules
set the time from rtc themselves, so our job is just to adjust the tz.
(FWIW, this coincides with what systemd does).

To get the old behavior of not touching the rtc, set it to anything
anything else.

We should probably have chosen a syntax for this, like IGNORE. Maybe
another time...

Signed-off-by: Tom Gundersen <teg at jklm.no>
 rc.sysinit |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index b2b0943..7b42388 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -43,10 +43,11 @@ findmnt / --options ro &>/dev/null ||
 bootlogd -p /run/bootlogd.pid
-	UTC) HWCLOCK_PARAMS+=" --utc";;
-	localtime) HWCLOCK_PARAMS+=" --localtime";;
+	"") ;;
+	UTC) HWCLOCK_PARAMS+=" --utc --noadjfile";;
+	localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile";;
@@ -63,7 +64,7 @@ if [[ $HWCLOCK_PARAMS ]]; then
-	# Do a clock set here for a few reasons:
+	# Adjust the system time for timezone offset if rtc is not in UTC
 	# 1. Make creation time on udev nodes sane (FS#8665)
 	# 2. Filesystem checks can depend on system time
 	# 3. This will set the clock, if using non-UTC, off the last known
@@ -72,7 +73,7 @@ if [[ $HWCLOCK_PARAMS ]]; then
 	# This does *NOT* take into account a time adjustment file as /var may not be
 	# mounted yet. A second set may occur in rc.d/hwclock to match rc.conf.
 	if [[ -f /etc/localtime ]]; then
-		hwclock $HWCLOCK_PARAMS --noadjfile
+		hwclock $HWCLOCK_PARAMS

More information about the arch-projects mailing list