Add support for newer CPU models.
[dragonfly.git] / usr.sbin / ntpd / patches / util.c.patch
bloba5371ed1f8952d625ecdd6dc0b5b57e0faa66daa
1 $DragonFly: src/usr.sbin/ntpd/patches/Attic/util.c.patch,v 1.3 2005/04/14 10:31:27 joerg Exp $
3 --- util.c 25 Feb 2005 16:43:19 -0000 1.5
4 +++ util.c 12 Apr 2005 20:13:45 -0000
5 @@ -16,6 +16,8 @@
6 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7 */
9 +#include <sys/types.h>
10 +#include <sys/sysctl.h>
11 #include <sys/time.h>
12 #include <limits.h>
14 @@ -32,6 +34,21 @@
15 return (tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec);
18 +double
19 +gettime_corrected(void)
21 + return (gettime() + getoffset());
24 +double
25 +getoffset(void)
27 + int64_t offset;
28 + size_t len = sizeof(offset);
29 + if (sysctlbyname("kern.ntp.delta", &offset, &len, NULL, 0))
30 + return (0.0);
31 + return (offset * 1e-9);
34 void
35 d_to_tv(double d, struct timeval *tv)