#!/bin/sh

ARC=0
UTC=0
SRM=0

if [ -f /etc/sysconfig/clock ]; then
    . /etc/sysconfig/clock

    # convert old style clock config to new values
    if [ "${CLOCKMODE}" = "GMT" ]; then
	    UTC=true
    elif [ "${CLOCKMODE}" = "ARC" ]; then
	    ARC=true
    fi
fi

CLOCKFLAGS="--systohc"

case "$UTC" in
   yes|true)
       CLOCKFLAGS="$CLOCKFLAGS -u"
   ;;
   no|false)
       CLOCKFLAGS="$CLOCKFLAGS --localtime"
   ;;
esac

case "$ARC" in
     yes|true)
        CLOCKFLAGS="$CLOCKFLAGS -A"
     ;;
esac
case "$SRM" in
     yes|true)
        CLOCKFLAGS="$CLOCKFLAGS -S"
     ;;
esac

/sbin/hwclock $CLOCKFLAGS

