Does our current implementation of ntp_gettime() make any sense?

On first glance it looks like a compatibility kludge for an ancient
version of struct ntptimeval only found on FreeBSD 3.x.

On more careful inspection, I notice that it doesn't even work!

$ cat ntp_gettime.c
#include <unistd.h>
#include <sys/timespec.h>
#include <sys/timex.h>
#include <stdio.h>

int
main ()
{
  struct ntptimeval tv;
  ntp_gettime (&tv);

  printf ("%ld\n", tv.time);
}
$ gcc ntp_gettime.c && ./a.out
6293856

But there is a ntp_gettime syscall now. Should we just replace this code
with a direct syscall stub?

$ cat syscall.c
#include <unistd.h>
#include <sys/timespec.h>
#include <sys/timex.h>
#include <sys/syscall.h>
#include <stdio.h>

int
main ()
{
  struct ntptimeval tv;
  syscall (SYS_ntp_gettime, &tv);

  printf ("%ld\n", tv.time);
}
$ gcc syscall.c && ./a.out
1379782489


-- 
Robert Millan


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/523dcfd3.2060...@debian.org

Reply via email to