1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# -*- sh -*-
# vim:ft=sh:ts=8:sw=4:noet
AddConfigHandler ClockOptions
AddConfigHelp "SaveClock restore-only|<boolean>" "Set this to yes to save the system clock before suspending and restore the system clock after resuming. If set to restore-only, the clock will not be saved, only restored - this means suspending is faster, but if your hardware clock drifts significantly, your system clock will drift as well."
ClockSave() {
if [ "x$DISTRIBUTION" = "xdebian" ] ; then
/etc/init.d/hwclock.sh stop > /dev/null 2>&1
else
if ! /sbin/hwclock --systohc ; then
echo "$EXE: Failed to save system clock - continuing anyway"
fi
fi
return 0 # clock save failing shouldn't be a show stopper, ever.
}
ClockRestore() {
if [ "x$DISTRIBUTION" = "xdebian" ] ; then
/etc/init.d/hwclock.sh start > /dev/null 2>&1
else
if ! /sbin/hwclock --hctosys ; then
echo "$EXE: Failed to restore system clock."
fi
fi
# exit code unchanged.
}
ClockOptions() {
local param
case $1 in
saveclock)
param=`echo $2 | tr '[A-Z]' '[a-z]'`
case "$param" in
restore*) # restore-only
AddResumeHook 70 ClockRestore
;;
*)
if BoolIsOn "$1" "$2" ; then
# put before module unloading and x switching.
AddSuspendHook 70 ClockSave
AddResumeHook 70 ClockRestore
fi
;;
esac
;;
*)
return 1
esac
return 0
}
# $Id: clock 621 2005-01-04 11:03:37Z dagobah $
|