_TITLE "Time difference" 'b+ mod r frost 2020-07-27
' ref r frost 2020-07-27 https://www.qb64.org/forum/index.php?topic=2861.msg121256#msg121256
' math with hh:mm:ss.dd
't1$ = "10:17:12.45"
't2$ = "11:53:52.18"
t1$ = "12:00:00.25" ' from noon and 1/4 sec
f1! = timeStr2Secs!(t1$)
f2! = timeStr2Secs!(t2$)
PRINT "============================" PRINT secs2TimeStr$
(f2!
- f1!
), INT(f2!
- f1!
+ .5)
timeStr2Secs! = hh * 60 * 60 + mm * 60 + s!
hh = secs! \ 3600
mm = (secs! - hh * 3600) \ 60
s! = (secs! - hh * 3600 - mm * 60)
s$ = xDP$(s!, 2)
secs2TimeStr$ = h$ + ":" + m$ + ":" + s$
xDP$ = test$