I have some time instants (A, B) and some time periods (C-D). I would like to find the time difference between each time period and the time instant matched to it. I mean that:

if the time (A or B) is between C and D

then dT = 0 

I've tried doing it like this:

```
df = pd.DataFrame({'A': [dt.datetime(2017,1,6),      dt.datetime(2017,1,4)],
                   'B': [dt.datetime(2017,1,7),      dt.datetime(2017,1,5)],
                   'C': [dt.datetime(2017,1,6,12,3), dt.datetime(2017,1,6,13,3)],
                   'D': [dt.datetime(2017,1,8,12,3), dt.datetime(2017,1,8,14,3)]})

# Calculate the time difference
def dT(Time, on, off):
    if Time < on:
        return on - Time
    elif Time > off:
        return Time - off
    else:
        return 0
dT = np.vectorize(dT)

df['dT_A'] = dT(df['A'], df['C'], df['D'])
df['dT_B'] = dT(df['B'], df['C'], df['D'])

# Change the time difference to a float
def floa(dT):
    if dT == 0:
        return 0
    else:
        return dT / timedelta (days=1)
floa = np.vectorize(floa)

df['dT_A'] = floa(df['dT_A'])
df['dT_B'] = floa(df['dT_B'])

```

It calculated `dt_A` but then it gave me this error:

```
OverflowError: Python int too large to convert to C long

```