hwclock: always use --noadjfile if available
When we use the --utc or --localtime switch, also use --noadjfile if it is available. This means hwclock will not use a drift file. X-Gentoo-Bug: 584722 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=584722
This commit is contained in:
parent
5537994002
commit
ac8ad169ae
@ -69,6 +69,16 @@ _hwclock()
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_noadjfile()
|
||||||
|
{
|
||||||
|
if ! yesno $clock_adjfile; then
|
||||||
|
# Some implementations don't handle adjustments
|
||||||
|
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
|
||||||
|
echo --noadjfile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local retval=0 errstr=""
|
local retval=0 errstr=""
|
||||||
@ -91,16 +101,16 @@ start()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Always set the kernel's time zone.
|
# Always set the kernel's time zone.
|
||||||
_hwclock --systz $utc_cmd $clock_args
|
_hwclock --systz $utc_cmd $(get_noadjfile) $clock_args
|
||||||
: $(( retval += $? ))
|
: $(( retval += $? ))
|
||||||
|
|
||||||
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
|
if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
|
||||||
_hwclock --adjust $utc_cmd
|
_hwclock --adjust $utc_cmd $(get_noadjfile)
|
||||||
: $(( retval += $? ))
|
: $(( retval += $? ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if yesno ${clock_hctosys:-YES}; then
|
if yesno ${clock_hctosys:-YES}; then
|
||||||
_hwclock --hctosys $utc_cmd $clock_args
|
_hwclock --hctosys $utc_cmd $(get_noadjfile) $clock_args
|
||||||
: $(( retval += $? ))
|
: $(( retval += $? ))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -122,14 +132,7 @@ stop()
|
|||||||
|
|
||||||
ebegin "Setting hardware clock using the system clock" "[$utc]"
|
ebegin "Setting hardware clock using the system clock" "[$utc]"
|
||||||
|
|
||||||
if ! yesno $clock_adjfile; then
|
_hwclock --systohc $utc_cmd $(get_noadjfile) $clock_args
|
||||||
# Some implementations don't handle adjustments
|
|
||||||
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
|
|
||||||
utc_cmd="$utc_cmd --noadjfile"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
_hwclock --systohc $utc_cmd $clock_args
|
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
eend $retval "Failed to sync clocks"
|
eend $retval "Failed to sync clocks"
|
||||||
@ -144,5 +147,5 @@ save()
|
|||||||
show()
|
show()
|
||||||
{
|
{
|
||||||
setupopts
|
setupopts
|
||||||
hwclock --show "$utc_cmd" $clock_args
|
hwclock --show "$utc_cmd" $(get_noadjfile) $clock_args
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user