# hwclock-save - save system clock to hardware clock
#
# ::do_not_edit::
# ::maintainer::
#
# This task saves the time from the system clock back to the hardware
# clock on shutdown.

description	"save system clock to hardware clock"

start on runlevel [06]

task

script
    . /etc/default/rcS
    [ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
    [ "$BADYEAR" = "yes" ] && badyear="--badyear"

    #[ku]
    #	patchd to use /etc/default/rcS setting for device instead
    #	of a fixed one
    #
    #exec hwclock --rtc=/dev/rtc0 --systohc $tz --noadjfile $badyear
    #
    HCTOSYS_DEVICE=${HCTOSYS_DEVICE:-"rtc"}
    exec hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $tz --noadjfile $badyear
end script
