This patch was contributed by  Michael Tatarin and allows openntpd 3.7
to work on QNX 6.

--- openntpd-3.7p1/configure.ac	2005-05-23 16:11:08.000000000 +0500
+++ openntpd-3.7p1.dev/configure.ac	2005-06-14 18:41:38.000000000 +0500
@@ -68,6 +68,9 @@
 	AC_DEFINE(__need_IOV_MAX, [],
 	    [Needed to get IOV_MAX from stdio.h on Linux])
 	;;
+*-*-nto-qnx*)
+	AC_DEFINE(DEF_IOV_MAX, UIO_MAXIOV, [from <sys/uio.h>])
+	;;
 *-*-qnx*)
 	AC_DEFINE(SETEUID_BREAKS_SETUID,[],[setuid after seteuid doesn't work])
 	AC_DEFINE(BROKEN_SETREUID,[], [Broken setreuid])
@@ -89,11 +92,32 @@
 	;;
 esac
 
+# Checks for header files.
 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h ctype.h ifaddrs.h netdb.h \
-	paths.h poll.h stdarg.h \
+	paths.h poll.h sys/poll.h stdarg.h \
 	sys/bitypes.h sys/fcntl.h sys/queue.h sys/select.h sys/time.h \
-	sys/socket.h sys/timers.h sys/timex.h sys/types.h syslog.h)
+	sys/socket.h sys/timers.h sys/timex.h sys/types.h syslog.h \
+	sched.h sys/sched.h sys/mman.h)
+
+# Checks for libraries.
+case "$host" in
+	*-*-netbsd*)
+	# exist, but not need
+	;;
+	*) AC_CHECK_LIB(rt, main)
+	;;
+esac
+AC_CHECK_LIB(posix4, main)
+AC_CHECK_LIB(socket, main)
+case "$host" in
+	*-*-linux*)
+	# exist, but not need
+	;;
+	*) AC_CHECK_LIB(nsl, main)
+	;;
+esac
 
+# Checks for functions.
 AC_CHECK_DECLS(asprintf, ,
 	[saved_CFLAGS="$CFLAGS"
 	 CFLAGS="$CFLAGS -D_GNU_SOURCE"
@@ -102,17 +126,10 @@
 	]
 )
 
-AC_CHECK_FUNCS(socketpair, ,
-	[saved_LDFLAGS="$LDFLAGS"
-	 LDFLAGS="$LDFLAGS -lsocket -lnsl"
-	 unset ac_cv_func_socketpair
-	 AC_CHECK_FUNCS(socketpair, , LDFLAGS="$saved_LDFLAGS")
-	]
-)
-
-AC_CHECK_FUNCS(adjtime adjtimex arc4random asprintf bzero clock_getres daemon \
-	getifaddrs inet_pton poll select setgroups setproctitle snprintf \
-	strlcpy vsnprintf vsyslog)
+AC_CHECK_FUNCS(adjtime adjtimex arc4random asprintf bzero clock_getres \
+	clock_gettime clock_settime daemon getifaddrs inet_pton poll \
+	select setgroups setproctitle snprintf strlcpy socketpair vsnprintf \
+	vsyslog)
 
 dnl Check for uidswap functions
 AC_CHECK_FUNCS(setuid setgid seteuid setegid setreuid setregid \
@@ -136,6 +153,25 @@
                 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
                 [Define if gai_strerror() returns const char *])])])
 
+case "$host" in
+	*-*-aix[[45]]*)
+	# Declare, but not implemented
+	;;
+	*-*-qnx*)
+	# Declare, but not implemented
+	;;
+	*) AC_CHECK_FUNCS(mlockall)
+	;;
+esac
+
+case "$host" in
+	*-*-aix[[45]]*)
+	# Declare, but not implemented
+	;;
+	*) AC_CHECK_FUNCS(sched_setscheduler)
+	;;
+esac
+
 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
         AC_TRY_COMPILE(
                 [
--- openntpd-3.7p1/defines.h	2005-05-23 05:16:33.000000000 +0500
+++ openntpd-3.7p1.dev/defines.h	2005-06-14 18:41:38.000000000 +0500
@@ -41,7 +41,9 @@
 #endif
 
 #ifndef INFTIM
-# define INFTIM          (-1)
+# ifndef __QNXNTO__
+#  define INFTIM          (-1)
+# endif
 #endif
 
 #ifndef HAVE_BZERO
--- openntpd-3.7p1/includes.h	2005-05-23 16:11:08.000000000 +0500
+++ openntpd-3.7p1.dev/includes.h	2005-06-14 18:41:39.000000000 +0500
@@ -80,6 +80,9 @@
 #ifdef HAVE_ARPA_NAMESER_H
 # include <arpa/nameser.h>
 #endif
+#ifdef HAVE_SYS_TIMEX_H
+# include <sys/timex.h>
+#endif
 
 /* on IRIX, sa_len is a macro sys/socket.h that causes conflicts */
 #ifdef sa_len
--- openntpd-3.7p1/ntp.c	2005-03-13 16:38:33.000000000 +0400
+++ openntpd-3.7p1.dev/ntp.c	2005-06-14 18:41:39.000000000 +0500
@@ -29,13 +29,20 @@
 #endif
 #ifdef HAVE_POLL_H
 # include <poll.h>
-#endif
+#else
+# ifdef HAVE_SYS_POLL_H
+#  include <sys/poll.h>
+# endif /* HAVE_SYS_POLL_H */
+#endif /* HAVE_POLL_H */
 #include <pwd.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
 
 #include "ntpd.h"
 #include "ntp.h"
@@ -93,6 +100,12 @@
 		return (pid);
 	}
 
+#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
+	/* lock the process into memory */
+	if ( mlockall(MCL_CURRENT|MCL_FUTURE) == -1 )
+		log_warn("mlockall()");
+#endif /* HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE */
+
 	if ((se = getservbyname("ntp", "udp")) == NULL)
 		fatal("getservbyname");
 
@@ -106,8 +119,10 @@
 		fatal("stat");
 	if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0)
 		fatal("bad privsep dir permissions");
+#ifndef __QNXNTO__
 	if (chroot(pw->pw_dir) == -1)
 		fatal("chroot");
+#endif /* __QNXNTO__ */
 	if (chdir("/") == -1)
 		fatal("chdir(\"/\")");
 
--- openntpd-3.7p1/ntpd.h	2005-03-13 16:35:09.000000000 +0400
+++ openntpd-3.7p1.dev/ntpd.h	2005-06-14 18:41:39.000000000 +0500
@@ -250,6 +250,7 @@
 /* util.c */
 double			gettime(void);
 void			d_to_tv(double, struct timeval *);
+void			d_to_tp(double, struct timespec *);
 double			lfp_to_d(struct l_fixedpt);
 struct l_fixedpt	d_to_lfp(double);
 double			sfp_to_d(struct s_fixedpt);
--- openntpd-3.7p1/ntpd.c	2005-03-13 16:41:46.000000000 +0400
+++ openntpd-3.7p1.dev/ntpd.c	2005-06-14 18:41:39.000000000 +0500
@@ -29,7 +29,11 @@
 #include <fcntl.h>
 #ifdef HAVE_POLL_H
 # include <poll.h>
-#endif
+#else
+# ifdef HAVE_SYS_POLL_H
+#  include <sys/poll.h>
+# endif /* HAVE_SYS_POLL_H */
+#endif /* HAVE_POLL_H */
 #include <pwd.h>
 #include <resolv.h>
 #include <signal.h>
@@ -37,6 +41,22 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
+#ifdef HAVE_SCHED_SETSCHEDULER
+# ifdef HAVE_SCHED_H
+#  include <sched.h>
+# else
+#  ifdef HAVE_SYS_SCHED_H
+#   include <sys/sched.h>
+#  endif /* HAVE_SYS_SCHED_H */
+# endif /* HAVE_SCHED_H */
+#else
+# ifndef SCHED_FIFO
+#  define SCHED_FIFO 1
+# endif
+#endif /* HAVE_SCHED_SETSCHEDULER */
 
 #include "ntpd.h"
 
@@ -47,6 +67,7 @@
 int		dispatch_imsg(struct ntpd_conf *);
 void		ntpd_adjtime(double);
 void		ntpd_settime(double);
+int		setscheduler(int, int);
 
 volatile sig_atomic_t	 quit = 0;
 volatile sig_atomic_t	 reconfig = 0;
@@ -75,7 +96,7 @@
 {
 	extern char *__progname;
 
-	fprintf(stderr, "usage: %s [-dSs] [-f file]\n", __progname);
+	fprintf(stderr, "usage: %s [-dSs] [-p priority] [-f file]\n", __progname);
 	exit(1);
 }
 
@@ -92,6 +113,7 @@
 	int			 ch, nfds, timeout = INFTIM;
 	int			 pipe_chld[2];
 	extern char		*__progname;
+	int			 priority = -1;
 
 	__progname = _compat_get_progname(argv[0]);
 
@@ -102,7 +124,7 @@
 	log_init(1);		/* log to stderr until daemonized */
 	res_init();		/* XXX */
 
-	while ((ch = getopt(argc, argv, "df:sS")) != -1) {
+	while ((ch = getopt(argc, argv, "df:sSp:")) != -1) {
 		switch (ch) {
 		case 'd':
 			conf.debug = 1;
@@ -116,6 +138,9 @@
 		case 'S':
 			conf.settime = 0;
 			break;
+		case 'p':
+			priority = atoi(optarg);
+			break;
 		default:
 			usage();
 			/* NOTREACHED */
@@ -136,6 +161,19 @@
 	}
 	endpwent();
 
+#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
+	/* lock the process into memory */
+	if ( mlockall(MCL_CURRENT|MCL_FUTURE) == -1 )
+		log_warn("mlockall()");
+#endif /* HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE */
+
+	if ( priority != -1 )
+	{
+		/* set scheduling parameters */
+		if ( setscheduler(SCHED_FIFO, priority) == -1 )
+			log_warn("sched_setscheduler()");
+	}
+
 #ifndef HAVE_ARC4RANDOM
 	seed_rng();
 #endif
@@ -319,6 +357,7 @@
 	return (0);
 }
 
+#ifndef __QNXNTO__
 void
 ntpd_adjtime(double d)
 {
@@ -333,33 +372,84 @@
 	if (adjtime(&tv, NULL) == -1)
 		log_warn("adjtime failed");
 }
+#endif /* not __QNXNTO__ (The QNX6 ntpd_adjtime() see in openbsd-compat/port-qnx.c) */
 
 void
 ntpd_settime(double d)
 {
-	struct timeval	tv, curtime;
+	struct timespec	curtime, adjtime;
 	char		buf[80];
-	time_t		tval;
 
-	/* if the offset is small, don't call settimeofday */
+	/* if the offset is small, don't set local clock */
 	if (d < SETTIME_MIN_OFFSET && d > -SETTIME_MIN_OFFSET)
 		return;
 
-	if (gettimeofday(&curtime, NULL) == -1) {
-		log_warn("gettimeofday");
+	if ( clock_gettime(CLOCK_REALTIME, &curtime) == -1 )
+	{
+		log_warn("clock_gettime()");
 		return;
 	}
-	d_to_tv(d, &tv);
-	curtime.tv_usec += tv.tv_usec + 1000000;
-	curtime.tv_sec += tv.tv_sec - 1 + (curtime.tv_usec / 1000000);
-	curtime.tv_usec %= 1000000;
 
-	if (settimeofday(&curtime, NULL) == -1) {
-		log_warn("settimeofday");
+	if ( d > 0 )
+	{
+		d_to_tp(d, &adjtime);
+		curtime.tv_sec += adjtime.tv_sec;
+		curtime.tv_nsec += adjtime.tv_nsec;
+		if ( curtime.tv_nsec >= 1000000000 )
+		{
+			curtime.tv_sec++;
+			curtime.tv_nsec -= 1000000000;
+		}
+	}
+	else
+	{
+		d = -d;
+		d_to_tp(d, &adjtime);
+		curtime.tv_sec -= adjtime.tv_sec;
+		curtime.tv_nsec -= adjtime.tv_nsec;
+		if ( curtime.tv_nsec < 0 )
+		{
+			curtime.tv_sec--;
+			curtime.tv_nsec += 1000000000;
+		}
+		d = -d; /* for logging */
+	}
+
+	if ( clock_settime(CLOCK_REALTIME, &curtime) == -1 )
+	{
+		log_warn("clock_settime()");
 		return;
 	}
-	tval = curtime.tv_sec;
+
 	strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %Z %Y",
-	    localtime(&tval));
+	    		localtime(&curtime.tv_sec));
 	log_info("set local clock to %s (offset %fs)", buf, d);
 }
+
+int
+setscheduler(int policy, int prio)
+{
+#ifdef HAVE_SCHED_SETSCHEDULER
+	int priomax, priomin;
+	struct sched_param sp;
+	
+	priomax = sched_get_priority_max(policy);
+	if ( prio > priomax )
+	{
+		sp.sched_priority = priomax;
+	}
+	else
+	{
+		priomin = sched_get_priority_min(policy);
+		if ( prio < priomin )
+			sp.sched_priority = priomin;
+		else
+			sp.sched_priority = prio;
+	}
+
+	return ( sched_setscheduler(0, policy, &sp) );
+#else
+	errno == ENOSYS;
+	return (-1);
+#endif /* HAVE_SCHED_SETSCHEDULER */
+}
--- openntpd-3.7p1/util.c	2004-12-14 05:18:35.000000000 +0400
+++ openntpd-3.7p1.dev/util.c	2005-06-14 18:41:40.000000000 +0500
@@ -16,6 +16,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <time.h>
 #include <sys/time.h>
 #include <limits.h>
 
@@ -24,20 +25,27 @@
 double
 gettime(void)
 {
-	struct timeval	tv;
+	struct timespec ts;
 
-	if (gettimeofday(&tv, NULL) == -1)
-		fatal("gettimeofday");
+	if ( clock_gettime(CLOCK_REALTIME, &ts) == -1 )
+		fatal("clock_gettime()");
 
-	return (tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec);
+	return (JAN_1970 + ts.tv_sec + ts.tv_nsec * 1e-9);
 }
 
 
 void
 d_to_tv(double d, struct timeval *tv)
 {
-	tv->tv_sec = (long)d;
-	tv->tv_usec = (d - tv->tv_sec) * 1000000;
+	tv->tv_sec = (time_t)d;
+	tv->tv_usec = (d - tv->tv_sec) * 1e6;
+}
+
+void
+d_to_tp(double d, struct timespec *tp)
+{
+	tp->tv_sec = (time_t)d;
+	tp->tv_nsec = (d - tp->tv_sec) * 1e9;
 }
 
 double
--- openntpd-3.7p1/openbsd-compat/Makefile.in	2004-12-20 03:41:36.000000000 +0400
+++ openntpd-3.7p1.dev/openbsd-compat/Makefile.in	2005-06-14 18:41:40.000000000 +0500
@@ -8,7 +8,7 @@
 
 OPENBSD=	asprintf.o daemon.o inet_pton.o strlcpy.o
 COMPAT=		atomicio.o bsd-arc4random.o bsd-misc.o bsd-poll.o \
-		bsd-snprintf.o fake-rfc2553.o uidswap.o
+		bsd-snprintf.o fake-rfc2553.o uidswap.o posix1003.o
 PORT=		port-qnx.o
 
 VPATH=@srcdir@
--- openntpd-3.7p1/openbsd-compat/openbsd-compat.h	2004-12-19 07:04:22.000000000 +0400
+++ openntpd-3.7p1.dev/openbsd-compat/openbsd-compat.h	2005-06-14 18:41:40.000000000 +0500
@@ -45,6 +45,9 @@
 #endif
 
 #ifndef HAVE_INET_PTON
+# ifndef INADDRSZ
+#  define INADDRSZ 4
+# endif
 int inet_pton(int, const char *, void *);
 #endif
 
@@ -68,11 +71,20 @@
 int vsnprintf(char *, size_t, const char *, va_list);
 #endif
 
+#ifndef CLOCK_REALTIME
+# define CLOCK_REALTIME	1
+#endif
+
 #ifndef HAVE_CLOCK_GETRES
-# ifndef CLOCK_REALTIME
-#  define CLOCK_REALTIME	1
-# endif
 int clock_getres(int, struct timespec *);
 #endif
 
+#ifndef HAVE_CLOCK_GETTIME
+int clock_gettime(int, struct timespec *);
+#endif
+
+#ifndef HAVE_CLOCK_SETTIME
+int clock_settime(int, struct timespec *);
+#endif
+
 int permanently_set_uid(struct passwd *);
--- openntpd-3.7p1/openbsd-compat/bsd-misc.c	2004-12-18 07:53:18.000000000 +0400
+++ openntpd-3.7p1.dev/openbsd-compat/bsd-misc.c	2005-06-14 18:41:40.000000000 +0500
@@ -19,14 +19,6 @@
 
 #include "includes.h"
 
-#ifdef HAVE_SYS_TIMEX_H
-/*
- * We can't put this in includes.h because of conflicting definitions of
- * ntp_adjtime.
- */
-# include <sys/timex.h>
-#endif
-
 #ifndef HAVE___PROGNAME
 char *__progname;
 #endif
@@ -94,32 +86,6 @@
 }
 #endif /* HAVE_VSYSLOG */
 
-#ifndef HAVE_CLOCK_GETRES
-int
-clock_getres(int clock_id, struct timespec *tp)
-{
-# ifdef HAVE_ADJTIMEX
-	struct timex tmx;
-# endif
-
-	if (clock_id != CLOCK_REALTIME)
-		return -1;	/* not implemented */
-	tp->tv_sec = 0;
-
-# ifdef HAVE_ADJTIMEX
-	tmx.modes = 0;
-	if (adjtimex(&tmx) == -1)
-		return -1;
-	else
-		tp->tv_nsec = tmx.precision * 1000;	/* usec -> nsec */
-# else
-	/* assume default 10ms tick */
-	tp->tv_nsec = 10000000;
-# endif
-	return 0;
-}
-#endif /* HAVE_CLOCK_GETRES */
-
 #ifndef HAVE_SETGROUPS
 int
 setgroups(size_t size, const gid_t *list)
--- openntpd-3.7p1/openbsd-compat/posix1003.c	1970-01-01 04:00:00.000000000 +0400
+++ openntpd-3.7p1.dev/openbsd-compat/posix1003.c	2005-06-14 18:41:41.000000000 +0500
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
+ * Copyright (c) 2004 Darren Tucker <dtucker at zip com au>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <errno.h>
+
+#include "includes.h"
+
+#ifndef HAVE_CLOCK_GETRES
+int
+clock_getres(int clock_id, struct timespec *tp)
+{
+# ifdef HAVE_ADJTIMEX
+	struct timex tmx;
+# endif
+
+	if ( clock_id != CLOCK_REALTIME )
+	{
+		errno == EINVAL;
+		return (-1);
+	}
+	
+	tp->tv_sec = 0;
+
+# ifdef HAVE_ADJTIMEX
+	tmx.modes = 0;
+	if (adjtimex(&tmx) == -1)
+		return -1;
+	else
+		tp->tv_nsec = tmx.precision * 1000;	/* usec -> nsec */
+# else
+	/* assume default 10ms tick */
+	tp->tv_nsec = 10000000;
+# endif
+	return 0;
+}
+#endif /* HAVE_CLOCK_GETRES */
+
+#ifndef HAVE_CLOCK_GETTIME
+int
+clock_gettime(int clock_id, struct timespec *tp)
+{
+	struct timeval tv;
+
+	if ( clock_id != CLOCK_REALTIME )
+	{
+		errno == EINVAL;
+		return (-1);
+	}
+
+	if ( gettimeofday(&tv, NULL) == -1 )
+		return (-1);
+
+	tp->tv_sec = tv.tv_sec;
+	tp->tv_nsec = tv.tv_usec * 1000;
+
+	return (0);
+}
+#endif /* HAVE_CLOCK_GETTIME */
+
+#ifndef HAVE_CLOCK_SETTIME
+int
+clock_settime(int clock_id, struct timespec *tp)
+{
+	struct timeval tv;
+
+	if ( clock_id != CLOCK_REALTIME )
+	{
+		errno == EINVAL;
+		return (-1);
+	}
+
+	tv.tv_sec = tp->tv_sec;
+	tv.tv_usec = tp->tv_nsec / 1000;
+
+	return (settimeofday(&tv, NULL));
+}
+#endif /* HAVE_CLOCK_SETTIME */
+
--- openntpd-3.7p1/openbsd-compat/port-qnx.c	2004-12-20 03:41:28.000000000 +0400
+++ openntpd-3.7p1.dev/openbsd-compat/port-qnx.c	2005-06-14 18:43:17.000000000 +0500
@@ -1,8 +1,9 @@
 /* $Id: port-qnx.c,v 1.1 2004/12/19 23:41:28 dtucker Exp $ */
 
 /*
- * Copyright (c) 2004 Anthony O.Zabelin <rz1a at mail.ru>
- *
+ * Copyright (c) 2004 Anthony O.Zabelin <rz1a at mail.ru> (QNX4)
+ * Copyright (c) 2005 Michael Tatarinov <mike at alba.com.ru> (QNX6)
+ * 
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
@@ -16,12 +17,17 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#if defined(__QNX__) && !defined(HAVE_ADJTIME)
+#include <ntpd.h>
+
+#ifdef __QNX__
+# ifndef __QNXNTO__
+#  ifndef HAVE_ADJTIME
 
 /*
- * Ajustment rate as a fraction of tick size.  Speeds or slows clock by
- * 1/rate per clock tick.
+ * Ajustment rate as a fraction of tick size.
+ * Speeds or slows clock by 1/rate per clock tick.
  */
+
 #define ADJUST_RATE	128
 
 #include <stdlib.h>
@@ -46,4 +52,43 @@
 	usec = delta->tv_sec * 1000000L + delta->tv_usec;
 	return(qnx_adj_time(usec, ADJUST_RATE, NULL, NULL));
 }
-#endif
+
+#  endif /* not HAVE_ADJTIME */
+# else /* not __QNXNTO__ (QNX4) */
+
+#include <math.h>
+#include <sys/neutrino.h>
+
+void
+ntpd_adjtime(double d)
+{
+	struct _clockadjust adj;
+	struct _clockperiod period;
+	
+	log_info("adjusting local clock by %fs", d);
+
+	if ( ClockPeriod(CLOCK_REALTIME, 0, &period, 0) == -1 )
+	{
+		log_warn("adjtime failed 'ClockPeriod()'");
+		return;
+	}
+
+	d *= 1e9; /* second -> nanosecond */
+	adj.tick_count = fabs(d / period.nsec) * 10.0;
+	if ( adj.tick_count == 0 )
+		adj.tick_nsec_inc = 0;
+	else 
+		adj.tick_nsec_inc = d / adj.tick_count;
+
+	if ( ClockAdjust(CLOCK_REALTIME, &adj, NULL) == -1 )
+	{
+		log_warn("adjtime failed 'ClockAdjust()'");
+		return;
+	}
+
+	log_debug("_clockadjust {tick_nsec_inc=%ld; tick_count=%lu}",
+			adj.tick_nsec_inc, adj.tick_count);
+}
+
+# endif /* __QNXNTO__ (QNX6) */
+#endif /* __QNX__ */
