unsigned long delta = elapsed[i-1];
When i = 0 which element of the array will the value of delta be taken from ?