#!/bin/sh
# Reset the System Clock to UTC if the hardware clock from which it
# was copied by the kernel was in localtime.

dev=$1

if [ -e /run/systemd/system ] ; then
    exit 0
fi

if [ -e /run/udev/hwclock-set ]; then
    exit 0
fi

if [ -f /etc/default/rcS ] ; then
    . /etc/default/rcS
fi

/sbin/hwclock --rtc=$dev --systz
/sbin/hwclock --rtc=$dev --hctosys

# Note 'touch' may not be available in initramfs
> /run/udev/hwclock-set
