Skip to content

Commit fe3bfc6

Browse files
committed
core-services/03-console-setup.sh: respect localtime hwclock
When TIMEZONE was unset or empty, the resulting empty TZ variable in the environment caused hwclock to set the timezone to UTC and ignore the value of /etc/localtime. Only set TZ when TIMEZONE is non-empty. Thanks to quinq in #voidlinux for finding the root cause of the bug. hwclock(8): The system timezone is configured by the TZ environment variable or the /etc/localtime file, as tzset(3) would interpret them. tzset(3): If the TZ variable does appear in the environment, but its value is empty, or its value cannot be interpreted using any of the formats specified below, then Coordinated Universal Time (UTC) is used. Fixes: 6394a10 (core-services/02-console-setup.sh: setup HARDWARECLOCK if set.)
1 parent 5b18be1 commit fe3bfc6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core-services/03-console-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ fi
2121

2222
if [ -n "$HARDWARECLOCK" ]; then
2323
msg "Setting up RTC to '${HARDWARECLOCK}'..."
24-
TZ=$TIMEZONE hwclock --systz \
24+
eval ${TIMEZONE:+TZ=$TIMEZONE} hwclock --systz \
2525
${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z) --noadjfile} || emergency_shell
2626
fi

0 commit comments

Comments
 (0)