summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntp.c
AgeCommit message (Collapse)Author
2007-01-15Although Unix compilers accept more than one definition of a globalOtto Moerbeek
symbol, follow the guidelines from K&R: only one definition of a global symbol (and possibly more declarations). Rename some vars here and there to avoid shadowing. ok henning@
2007-01-14Esape from the Mouth of Madness by adjusting stored sensor offsetsOtto Moerbeek
when we adjust time. This prevents ntpd from going wild when using sensor time sources; ok henning@ (on an earlier version) and a LOT of testing by naddy@
2006-12-20let ntpd use sensors immediately after system boot by special casingHenning Brauer
last_sensor_scan == 0. monotime might be very close to 0 after boot. source unknown, maybe from naddy, rediscovered & ok mblamer
2006-11-30Allow sensors in a sensors-only configuration to set the time at startup.Chris Kuethe
2006-10-27use clock_gettime(CLOCK_MONOTONIC, ..) to get a monotonically increasingHenning Brauer
time, and make ntpd use that to send the next uery to an ntp peer and the like. this has the advantage that changes to the clock do not interfere with the intervals. for example, when we start on machines without an RTC and the initial settime (-s) kicks in, intervals were strange. idea from amandal@entrisphere.com, this implementation by me tested ckuethe, phessler, mbalmer, ok mbalmer
2006-10-24timedelta sensors are usually updated very often, but we used to queryHenning Brauer
them only every 30 seconds. now query them every 5,and take the median value from 7 queries as sensor value. this takes outliers out of the equation and makes the overall result much better, especially for sensors with heavy jitter (like nmea for now)
2006-10-21 Found that even if client fd (i.e to NTP source) is set toHenning Brauer
-1 because of error, it may still participate in poll() causing poll() to repeatedly wake up on error fd. so make sure w edon't add -1 fds to pollevents to avoid unnecessary wakeups From: amandal@entrisphere.com
2006-07-01remove some unneeded includes; one found by vetinariOtto Moerbeek
2006-06-30spacesTheo de Raadt
2006-06-26increase polling intervbal, but only after we are synced and have doneOtto Moerbeek
a few frequency adjustments. ok henning@
2006-06-21avoid a race by installing SIGCHLD handler before fork() is called.Otto Moerbeek
ok henning@ ckuethe@
2006-06-17Import frequency conrrection code from dragonfly, whith some changes:Otto Moerbeek
only do frequency compensation if the clock is synced, and a slightly diffent way of computing the linear regression. You'll need a recent kernel and libc to use this. Testing by naddy@ and ckuethe@ and others, thanks! ok henning@
2006-06-09set session id and init logging in -s mode. tested by david@ and matthieu@;Otto Moerbeek
ok henning@
2006-06-08simplify; ok henning@Otto Moerbeek
2006-06-07Compensate old offsets with the amount of adjustment done, avoidingOtto Moerbeek
overcompensating. From DragonFly, uses recent adjtime(2) changes, so you'll need a recent kernel. ok henning@
2006-06-04Only invalidate stored replies if an adjustment was really made.Otto Moerbeek
ok henning@
2006-06-02incredibly stupid typoHenning Brauer
2006-06-01When expanding servers, do not forget to copy weight. ok henning@Otto Moerbeek
2006-06-01urgs, other stuff snuck inHenning Brauer
2006-06-01put back regular sensors scanningHenning Brauer
2006-05-31only actually run sensor_query when it is due, not every time poll returnsHenning Brauer
2006-05-28allow for weight to be added to sensors or servers, so that one canHenning Brauer
weight timedelta sensors higher than ntp peers, for example ok deraadt mbalmer
2006-05-28let sensor_query handle removals itselfHenning Brauer
2006-05-28DV_SENSORS is no more, plug workaround for the time to the real solutionHenning Brauer
2006-05-27stop passing the config around all time, just store one copyHenning Brauer
2006-05-27make ntpd listen on the hotplug socket and decode yadda yadda, becauseHenning Brauer
new sensors showing up will be announced that way when slacking ml comes back from food
2006-05-27scan for new timedelta sensors every five minutes for now, ok deraadtHenning Brauer
2006-05-26add support for timedelta sensors, which pretty much means udcf(4) rightHenning Brauer
now. untested due to lack of hardware, and it wouldn't have worked in the plane anyways. work in progress, currently picks up and uses all sensors it finds, config file bits to be added soon. theo fine with this going in
2006-05-25more bits from transatlanic flight:Henning Brauer
make priv_adjtime() deal with offsets, not peers.
2006-05-25figure out the refid to send to NTP v3 clients early and store itHenning Brauer
first bits from a way to long flight
2006-05-14PFD_MAX betterer than harcoded 1Henning Brauer
2005-08-10Propogate server's leap indicator flags to clients; ok henning@Darren Tucker
2005-08-08with -s, do not wait if we don't have any peers at all.Henning Brauer
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
2005-07-15remove recently added "using privsep user X" message, spams console in -sHenning Brauer
mode, noticed by kettenis
2005-07-15fix a function name in an error messageHenning Brauer
why this was rotting in my tree for so long, I dunno - and I dunno where it came from
2005-07-11Print privsep user and dir when in debug mode; ok henning@Darren Tucker
2005-07-05Save transmit time for each peer for later use as refid for SNTPv4Darren Tucker
replies. ok henning@
2005-06-19use a little state engine to keep track of delayed dns lookups and such,Henning Brauer
eases things tested by Jason Ackley <jason@ackley.net> Matthias Kilian <kili@outback.escape.de> Stephen Marley <stephen@marley.org.uk> sturm@ theo ok
2005-05-26Ensure previous adjust has completed before clearing alarm flag; ok henning@Darren Tucker
2005-05-23no need for endpwent(0 here eitherHenning Brauer
2005-05-03setres[ug]id; ok deraadt@Damien Miller
2005-04-18correctness: only account for offset after settime in next and deadlineHenning Brauer
when those timers are actually running. due to the way ntpd's logic works this does not really make a difference, but correctness is good. spotted by me, joerg agrees
2005-04-18after setting the clock hard correct the "next" and "deadline" timestampsHenning Brauer
by the offset From: Joerg Sonnenberger <joerg@britannica.bec.de>
2005-03-24one more fatal/fatalx, alexanderHenning Brauer
2005-03-08when trying short-circuit the wait for the first reply for -s, onlyHenning Brauer
do so when -we tried to send at least one query (that is the change) -we could not send ou a single one without failure (this was already in place but catched too much) problem independently noticed by nick and danh, ok mickey danh, testing by many
2005-03-08knfTheo de Raadt
2005-03-08missing break spotted by lintTheo de Raadt
2005-02-22when sending a query already returns a failure, we're not going to seeHenning Brauer
a reply to that query. if we get errors for all queries and the initial settime() is still due and thus the parent process still waits (not yet daemonized!), send an IMSG_SETTIME with offset 0. shortens the delay dramatically when you boot without network idea from a discussion with theo
2005-02-02KNFHenning Brauer
2005-01-28Simplify interval scaling and randomize query intervals; ok henning@Darren Tucker