1 1.2 christos /* $NetBSD: compat_ntp_gettime.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */ 2 1.1 drochner 3 1.1 drochner #include <sys/cdefs.h> 4 1.1 drochner #if defined(LIBC_SCCS) && !defined(lint) 5 1.2 christos __RCSID("$NetBSD: compat_ntp_gettime.c,v 1.2 2009/01/11 02:46:26 christos Exp $"); 6 1.1 drochner #endif /* LIBC_SCCS and not lint */ 7 1.1 drochner 8 1.1 drochner #define __LIBC12_SOURCE__ 9 1.1 drochner 10 1.1 drochner #include <sys/time.h> 11 1.1 drochner #include <sys/timex.h> 12 1.1 drochner #include <compat/sys/timex.h> 13 1.1 drochner 14 1.1 drochner __warn_references(ntp_gettime, 15 1.1 drochner "warning: reference to compatibility ntp_gettime(); include <sys/timex.h> for correct reference") 16 1.1 drochner 17 1.1 drochner int 18 1.1 drochner ntp_gettime(struct ntptimeval30 *ontvp) 19 1.1 drochner { 20 1.1 drochner struct ntptimeval ntv; 21 1.1 drochner int res; 22 1.1 drochner 23 1.2 christos res = __ntp_gettime50(&ntv); 24 1.2 christos ontvp->time.tv_sec = (int32_t)ntv.time.tv_sec; 25 1.2 christos ontvp->time.tv_usec = ntv.time.tv_nsec / 1000; 26 1.1 drochner ontvp->maxerror = ntv.maxerror; 27 1.1 drochner ontvp->esterror = ntv.esterror; 28 1.1 drochner 29 1.1 drochner return (res); 30 1.1 drochner } 31