Add function to give elapsed time between 2 measures.

This allow to simulate time or use an extern function to measure
time. This commit also add tests for the new functions.