As I understand it, in the case of partial overlap you just divide the
overlapping portion of B by A, so the direct division here would have the
same effect. I don't understand why is that division assuming A = 2B.
In any case, your function is heavier on the ifs, but mine has to do more
with each
M the third case coul be this, for example:
|---A-| |--A|
---
|B| |-B|
If I directly apply (his_diff/my_diff) I thi
In the third case, I didn't understand why you didn't divide (his_to -
his_from) / (my_to - my_from). Bearing that in mind, this made sense in my
head, but analyze it carefully:
def match(mf,mt,hf,ht):
mydiff = diff_in_seconds(mf,mt)
if (mf >= hf and mt <= ht) or (mf < hf and mt > ht):
I've develope a "simple" function to calculate the difference between 2
dates, and the time that they are interpolated.
I need it to: I arrive to a site at a hour (my_from), I go out from the site
at a hour (my_to). Some friend arrive at the site at a hour (his_from) and
let it at a hour (his_to)
4 matches
Mail list logo