1. A method comprising: receiving a first signal; receiving a second signal whose varying magnitude is similar to that of the first signal but is shifted in time; sampling the first and second signals to generate a discrete mathematical function; maintaining the discrete mathematical function at multiple sample points; and defining sets of overlapping ranges based on the sample points, at least one of the ranges being used to interpolate a point on the discrete mathematical function indicating a time difference between the first and second signals.