Only call systohw in clock when we don't have adjfile or we aren't UTC.

This commit is contained in:
Roy Marples 2007-05-30 12:17:35 +00:00
parent 8bcc145c98
commit ece3f4e666
2 changed files with 21 additions and 16 deletions

View File

@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts # ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
30 May 2007; Roy Marples <uberlord@gentoo.org>:
Only call systohw in clock when we don't have adjfile or we aren't UTC.
* baselayout-2.0.0_alpha3 (14 May 2007) * baselayout-2.0.0_alpha3 (14 May 2007)
14 May 2007; Roy Marples <uberlord@gentoo.org>: 14 May 2007; Roy Marples <uberlord@gentoo.org>:

View File

@ -79,24 +79,25 @@ start() {
ebegin "Setting system clock using the hardware clock" "[${TBLURB}]" ebegin "Setting system clock using the hardware clock" "[${TBLURB}]"
if [ ${fakeit} -eq 1 ] ; then if [ ${fakeit} -eq 1 ] ; then
ret=0 retval=0
elif [ -x /sbin/hwclock ] ; then elif [ -x /sbin/hwclock ] ; then
# Since hwclock always exit's with a 0, need to check its output. # Don't call hwclock unless we need to
errstr="$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null)" if [ "${TBLURB}" != "UTC" -o "${myadj}" != "--noadjfile" ] ; then
errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)" # Since hwclock always exit's with a 0, need to check its output.
errstr="$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null)"
errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)"
if [ -n "${errstr}" ] ; then if [ -n "${errstr}" ] ; then
ewarn "${errstr}" ewarn "${errstr}"
ret=1 retval=1
else fi
ret=0 errstr="Failed to set clock"
fi fi
errstr="Failed to set clock"
else else
ret=1 retval=1
errstr="/sbin/hwclock not found" errstr="/sbin/hwclock not found"
fi fi
eend ${ret} "${errstr}" "You will need to set the clock yourself" eend ${retval} "${errstr}" "You will need to set the clock yourself"
return 0 return 0
} }
@ -111,16 +112,16 @@ stop() {
ebegin "Setting hardware clock using the system clock" "[${TBLURB}]" ebegin "Setting hardware clock using the system clock" "[${TBLURB}]"
if [ ${fakeit} -eq 1 ] ; then if [ ${fakeit} -eq 1 ] ; then
ret=0 retval=0
elif [ -x /sbin/hwclock ] ; then elif [ -x /sbin/hwclock ] ; then
[ -z "$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)" ] [ -z "$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)" ]
ret=$? retval=$?
errstr="Failed to sync clocks" errstr="Failed to sync clocks"
else else
ret=1 retval=1
errstr="/sbin/hwclock not found" errstr="/sbin/hwclock not found"
fi fi
eend ${ret} "${errstr}" eend ${retval} "${errstr}"
} }
save() { save() {