Difference between two time durations
by ychaouche from LinuxQuestions.org on (#5DYS6)
Dear #LQ,
This is not necessarily a programming question, any command that does the trick is welcome, the trick being how to calculate the difference between two time durations like 01:20:50 - 00:50:27 ? Best I could come up with was with the dateutils.ddif command
Code:ychaouche#ychaouche-PC 10:03:40 ~ $ dateutils.ddiff -f "%H:%M:%S" "01:50:00" "00:27:00"
-1:-23:0
ychaouche#ychaouche-PC 10:03:47 ~ $But as you can see I couldn't get proper formatting (ideally, the output would look like so : 01:23:00)


This is not necessarily a programming question, any command that does the trick is welcome, the trick being how to calculate the difference between two time durations like 01:20:50 - 00:50:27 ? Best I could come up with was with the dateutils.ddif command
Code:ychaouche#ychaouche-PC 10:03:40 ~ $ dateutils.ddiff -f "%H:%M:%S" "01:50:00" "00:27:00"
-1:-23:0
ychaouche#ychaouche-PC 10:03:47 ~ $But as you can see I couldn't get proper formatting (ideally, the output would look like so : 01:23:00)