Use sysctlbyname() instead of sysctl().

This commit is contained in:
Poul-Henning Kamp 1999-03-05 10:01:24 +00:00
parent 5d57729b8a
commit c40956e25d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44477

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] =
"$Id$";
"$Id: ntp_gettime.c,v 1.4 1997/02/22 14:58:12 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -44,14 +44,10 @@ static const char rcsid[] =
int
ntp_gettime(struct ntptimeval *ntv)
{
int mib[3];
struct ntptimeval tv;
size_t size = sizeof tv;
mib[0] = CTL_KERN;
mib[1] = KERN_NTP_PLL;
mib[2] = NTP_PLL_GETTIME;
if (sysctl(mib, 3, &tv, &size, NULL, 0) == -1)
if (sysctlbyname("kern.ntp_pll.gettime", &tv, &size, NULL, 0) == -1)
return TIME_ERROR;
if(ntv) *ntv = tv;
return tv.time_state;