2011/3/21 Rony gnulinuxist@gmail.com:
I am stuck at the point of calculating time difference. There doesn't seem to be a direct command that will calculate time difference in HH:MM format. This link mentions a work around
Even if you find one, remember that such a command would be internally converting to seconds-since-epoch and then doing the arithmetic.
figure is not constant. One way out is that every day the %s figure is generated at exactly 10:00 and this is then 'diff'ed with the user's attendance time in %s. This is then divided by 60.
You don't need to do that. You can simply do:
late=$(( `date '+%s'` - `date '+%s' -d 'today 10am'` ))
And then convert $late to any format you want.
Binand