$DragonFly: src/usr.sbin/ntpd/patches/Attic/util.c.patch,v 1.3 2005/04/14 10:31:27 joerg Exp $ --- util.c 25 Feb 2005 16:43:19 -0000 1.5 +++ util.c 12 Apr 2005 20:13:45 -0000 @@ -16,6 +16,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include +#include #include #include @@ -32,6 +34,21 @@ return (tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec); } +double +gettime_corrected(void) +{ + return (gettime() + getoffset()); +} + +double +getoffset(void) +{ + int64_t offset; + size_t len = sizeof(offset); + if (sysctlbyname("kern.ntp.delta", &offset, &len, NULL, 0)) + return (0.0); + return (offset * 1e-9); +} void d_to_tv(double d, struct timeval *tv)