calculating difference of times

Robert Huff roberthuff at
Fri Jul 27 12:55:20 UTC 2012

Matthias Apitz writes:

>  Do we have something (in the ports) to calculate easy the
>  difference of two times given as hh:mm - hh:mm? Some hack in
>  bc(1) or something like this? Well, I could translate the times
>  into UNIX seconds of epoche, build the diff and reconvert, but
>  something more easy (and not in Perl or C, just shell); thanks

	I don't know if there's something already available. (Sorry -
never had this problem.)
	If the format is fixed, then parsing it with awk is trivial.
After that, the math should be doable with "expr".

				Robert Huff

More information about the freebsd-questions mailing list