[ntp:questions] Creating a multi-minute offset
"terje.mathisen at tmsw.no" at ntp.org
Fri Feb 24 10:35:18 UTC 2012
A C wrote:
> On 2/22/2012 23:56, David Woolley wrote:
>> A C wrote:
>>> Ok, so here's an odd question but I had an amusing thought so I want
>>> to know:
>>> Is it possible to force a client to synchronize with network servers
>>> but also maintain a time offset of several minutes from those servers?
>> If this isn't just a special case of timezones, you would need to modify
>> the OS interface layer of the code to shift the time when reading and
>> writing the system clock, so that the core of ntpd sees the correct time.
> Yeah, it's not a matter of time zone, it's trying to force an absolute
> time lag on one machine as part of a simulation. The idea was that the
> clocks should run at the same speed but one of them needs to be shifted
> from the other.
> It was a thought but obviously it doesn't work.
This is perfectly possible, but it does require a small source code patch:
The proper way to do it is to modify all the fudge code so that relevant
parts can be deployed on network servers.
I am thinking particularly on the ability to measure (using a temporary
local refclock) any constant time bias on a non-symmetric uplink, like
many/most ADSL links, and then fudge that out.
Such a facility would also be able to handle your desire for a simulated
(In fact, it could also be used to easily test how a particular system
would handle a previous or upcoming leapsecond, by fudging the reference
enough months backwards/forwards.)
This is not a trivial job however.
Much easier is to grab the source code and make a local patch where you
simply add/subtract a constant offset to all timestamps received from
This could be done in the ntp packet parsing code, with a two-line
If you do so, _please_ make absolutely sure that you never provide time
service to anyone outside your test network!
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
More information about the questions