Re: Interpolation and comparation between 2 dates: easy and difficult at the same time

2010-08-07 Thread Paulo Almeida
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

Re: Interpolation and comparation between 2 dates: easy and difficult at the same time

2010-08-06 Thread Alexandre González
M the third case coul be this, for example: |---A-| |--A| --- |B| |-B| If I directly apply (his_diff/my_diff) I

Re: Interpolation and comparation between 2 dates: easy and difficult at the same time

2010-08-05 Thread Paulo Almeida
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):

Interpolation and comparation between 2 dates: easy and difficult at the same time

2010-08-05 Thread Alexandre González
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)