I am trying to calculate time between two peaks. Let suppose the first peak appear at 31 seconds and 56 milliseconds. The second peak appears at 32 second and 37 milliseconds. I can simply subtract 32.37-31.56, which is around 0.8. What if the first peak appears at 59.32 seconds, and a second peak at 00.32 of the next minute. How can I subtract this?
So I have to incorporate minutes. I used datetime.now().strftime("%M:%S.%f") to get minutes, seconds and milliseconds. The output is a string such as '49:31.566308'. How I can subtract it from '49:32.069660'
I tried to subtract two date-time like the following but failed
x=datetime.now().time()
sleep(2)
datetime.now().time()-x
I got this error
TypeError: unsupported operand type(s) for -: 'datetime.time' and 'datetime.time'
datetime.timdeltashould meet your needs.