1*461a86f9Schristos /* $NetBSD: compat_ntp_gettime.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */ 2837ecb8cSdrochner 3837ecb8cSdrochner #include <sys/cdefs.h> 4837ecb8cSdrochner #if defined(LIBC_SCCS) && !defined(lint) 5*461a86f9Schristos __RCSID("$NetBSD: compat_ntp_gettime.c,v 1.2 2009/01/11 02:46:26 christos Exp $"); 6837ecb8cSdrochner #endif /* LIBC_SCCS and not lint */ 7837ecb8cSdrochner 8837ecb8cSdrochner #define __LIBC12_SOURCE__ 9837ecb8cSdrochner 10837ecb8cSdrochner #include <sys/time.h> 11837ecb8cSdrochner #include <sys/timex.h> 12837ecb8cSdrochner #include <compat/sys/timex.h> 13837ecb8cSdrochner 14837ecb8cSdrochner __warn_references(ntp_gettime, 15837ecb8cSdrochner "warning: reference to compatibility ntp_gettime(); include <sys/timex.h> for correct reference") 16837ecb8cSdrochner 17837ecb8cSdrochner int ntp_gettime(struct ntptimeval30 * ontvp)18837ecb8cSdrochnerntp_gettime(struct ntptimeval30 *ontvp) 19837ecb8cSdrochner { 20837ecb8cSdrochner struct ntptimeval ntv; 21837ecb8cSdrochner int res; 22837ecb8cSdrochner 23*461a86f9Schristos res = __ntp_gettime50(&ntv); 24*461a86f9Schristos ontvp->time.tv_sec = (int32_t)ntv.time.tv_sec; 25*461a86f9Schristos ontvp->time.tv_usec = ntv.time.tv_nsec / 1000; 26837ecb8cSdrochner ontvp->maxerror = ntv.maxerror; 27837ecb8cSdrochner ontvp->esterror = ntv.esterror; 28837ecb8cSdrochner 29837ecb8cSdrochner return (res); 30837ecb8cSdrochner } 31