#!/bin/sh 

ARC=0
UTC=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

if [ -x /sbin/hwclock ]; then
    CLOCKFLAGS="--systohc"
    CLOCK=/sbin/hwclock
else
    CLOCKFLAGS="-w"
    CLOCK=/sbin/clock
fi

if [ $UTC = "true" ]; then
    CLOCKFLAGS="$CLOCKFLAGS -u";
fi
if [ $ARC = "true" ]; then
    CLOCKFLAGS="$CLOCKFLAGS -A";
fi

$CLOCK $CLOCKFLAGS

