../kde/bin/kclock.sh

#! /bin/sh
#
# Parameters passed from kclock:
#
# $1 = MM       Months  (01..12)
# $2 = DD       Day     (01..31)
# $3 = hh       Hour    (00..23)
# $4 = mm       Minute  (00..59)
# $5 = YYYY     Year    (0000..9999)
# $6 = ss       Second  (00..59)
#
# Return Values:
#
#  0 = OK
# -1 = Wrong number of parameters
# -2 = date command failed
# -3 = clock command failed

if [ $# != 6 ]
        then exit -1    #Wrong number of parameter
fi
/bin/date $1$2$3$4$5.$6 >/dev/null 2>/dev/null
if [ $? != 0 ]
        then exit -2    #Wrong syntax or wrong values
fi
# Add flag -u if the CMOS clock is set to Universal Time (/sbin/clock -w -u)
/sbin/clock -w >/dev/null 2>/dev/null
if [ $? != 0 ]
        then exit -3    #Hummmm, bad conditions...
fi
exit 0                  #Ok !


This is the shell responsible to set date & time of your computer, it receives six parameters from kclock then pass them to "date" command and finally write it to CMOS clock with the "clock" command.
Remember if you have to refresh any program or any host do it in this shell,  and if your CMOS clock is set to Universal Time, add -u flag to "clock" command.

Go back