[time-nuts] looking for good description/generalized model for time adjustments

Lux, James P (337C) james.p.lux at jpl.nasa.gov
Wed Jul 29 16:54:40 UTC 2009


I'm looking for a good (short) description and/or a generalized model for relating a local time counter to some external reference.  Here's the scenario..
A computer has a local clock that is a counter being driven by a local oscillator.
Periodically, we get "time updates" from some outside source that give an "absolute time" and a sync.

We need to use "calibrated time" to record log files and schedule events.

A simple way to relate local counter to absolute time is:
Calibrated time = (local counter / counter rate estimate) + time offset.

Calculating the rate estimate from (local counter at time B - local counter at time A) / (absolute time at time B - absolute time at time A)
And offset in a similar way.

But this has the problem that the "calibrated time" might have discontinuities.  Especially if you change the rate estimate and offset in a step function.  Calibrated time might even go backwards.

I guess an additional requirement on "Calibrated time" is that it be continuous and monotonically increasing.  I can see that one can get this by "gradually" adjusting the rate estimate and offset (i.e. if your local clock runs fast so your local calibrated time has gotten ahead of absolute time, you set the rate lower than the true rate until it has slipped back fast and then slowly bring the rate back to the true rate)

And this works pretty well if the outside reference is "better" than my local clock (and is essentially what NTP does, right?), but what if the reverse is true.
Consider if my local clock is high quality, but I have to discipline Calibrated Time to an outside time that is of much poorer quality.  (By the gods, it's 6AM when the sun rises and 6PM when the sun sets, so make everything adjust to fit that, and don't give me grief about seasonal variations in sunrise/set times).

What's a good way to do this, hopefully that allows later reconstruction of what the history of transformations was (e.g. I should be able to take my calibrated time, and convert it back into local counter time, by using the log of changes in model parameters).

Thanks for ideas and pointers in advance
Jim





James Lux, P.E.
Task Manager, SOMD Software Defined Radios
Flight Communications Systems Section
Jet Propulsion Laboratory
4800 Oak Grove Drive, Mail Stop 161-213
Pasadena, CA, 91109
+1(818)354-2075 phone
+1(818)393-6875 fax


More information about the time-nuts mailing list