Calculation of the difference in duration mm:ss:ms

734 Views Asked by At

Please could anyone provide an easy formula to manually calculate the difference in duration in the format of minutes:seconds:milliseconds ?

For example, how to calculate the difference between the following durations - 02:06:84 - 1:36:91

and 2:08:46 - 1:38:17

etc

Thank you

2

There are 2 best solutions below

1
On

It is just like subtraction with borrowing. Seconds and milliseconds can be combined into seconds with a decimal point, but when you borrow from the minutes you have to add $60$ to the seconds. In normal subtraction the next place is $10$ times larger, so you add $10$ to the current place. That is concealed by our positional notation-putting a $1$ in front of a number is really adding $10$ to it. So $2:06:84-1:36:91$ can be converted to $2:06.84-1:36.91$ When you subtract $6.84-36.91$ you have to borrow a minute, so you get $60$ more seconds and subtract $1:66.84-1:36.91=0:29.97=0:29:97$$

3
On

First $02:06:84$ look more like minutes, seconds and centiseconds to me.

To carry over the subtraction $\begin{array}{ll}&\mathtt{MM:SS.CC}\\-& \mathtt{mm:ss.cc}\\\hline=&\mathtt{xx:yy.zz} \end{array}$

You do the following:

  • If $CC\ge cc$ then $zz=CC-cc$ and $r_z=0$
  • Else $zz=100+CC-cc$ and $r_z=1$

  • If $SS\ge ss+r_z$ then $yy=SS-(ss+r_z)$ and $r_y=0$
  • Else $yy=60+SS-(ss+r_z)$ and $r_y=1$

  • Finally $xx=MM-(mm+r_y)$

$\begin{array}{lll}&\mathtt{02}&:\mathtt{\overset{\color{blue}{6}}{0}6}&.\mathtt{\color{green}{^1}84}\\-& \mathtt{01_\color{blue}{+1}}&:\mathtt{36_\color{green}{+1}}&.\mathtt{91}\\\hline=&\mathtt{00}&:\mathtt{29}&.\mathtt{93} \end{array}$