Measure time between rising and falling edge

Take a look at this topic