#!/bin/sh


readdate()
{
	OIFS="$IFS"
	IFS="/: "

	echo -n "date: " >&2
	read dd mm yy hh mm ss
	date=`expr $hh \* 3600 + $mm \* 60 + $ss`

	echo $date
}

displaydate()
{
	date=$1

	echo -n `expr $date / 3600`":"
	date=`expr $date % 3600`
	echo -n `expr $date / 60`":"
	date=`expr $date % 60`
	echo $date
}

read foo
date1=`readdate`
read foo
date2=`readdate`
ddate=`expr $date2 - $date1`

echo -n "Maņana: "
displaydate $ddate

echo -n "Total: "
displaydate $ddate

ddate=`expr $ddate - \`expr 7 \* 3600\``

echo -n "Balance: "

if [ $ddate -lt 0 ]
then
	echo -n "-"
	ddate=`expr 0 - $ddate`
fi
displaydate $ddate

