#!/bin/sh
#
# $Id: showtime,v 1.5 2004/06/21 08:25:58 kleing Exp $
# Author: Markus Wenzel, TU Muenchen
#
# showtime - print time.

TIME=$(( `date +'%j * 86400 + %H * 3600 + %M * 60 + %S'` - "$1" ))

SECS=$(( $TIME % 60 ))
[ $SECS -lt 10 ] && SECS="0$SECS"

MINUTES=$(( ($TIME / 60) % 60 ))
[ $MINUTES -lt 10 ] && MINUTES="0$MINUTES"

HOURS=$(( $TIME / 3600 ))

echo "${HOURS}:${MINUTES}:${SECS}"


syntax highlighted by Code2HTML, v. 0.9.1