diff -r -u ntp-4.2.2+dfsg.2/ntpd/refclock_atom.c ntp-4.2.2+dfsg.2local/ntpd/refclock_atom.c
--- ntp-4.2.2+dfsg.2/ntpd/refclock_atom.c	2006-06-06 16:16:48.000000000 -0400
+++ ntp-4.2.2+dfsg.2local/ntpd/refclock_atom.c	2006-08-13 17:15:57.000000000 -0400
@@ -155,6 +155,9 @@
 	register struct ppsunit *up;
 	char	device[80];
 	int	mode;
+#ifdef PPS_HAVE_FINDSOURCE
+	char	id[80];	/* Source description */
+#endif
 #endif /* HAVE_PPSAPI */
 
 	/*
@@ -175,13 +178,27 @@
 	 * Open PPS device. This can be any serial or parallel port and
 	 * not necessarily the port used for the associated radio.
 	 */
+#ifdef PPS_HAVE_FINDSOURCE
+	/* Find the source corresponding to the requested unit number. */
+	/* See /proc/pps/sources for a list of the possibilities. */
+	up->fddev = time_pps_findsource(unit, device, sizeof device,
+		id, sizeof id);
+	if (up->fddev < 0) {
+		msyslog(LOG_ERR,
+			"refclock: no available PPS source in the system");
+		return 0;
+	}
+	msyslog(LOG_INFO, "refclock: found PPS source #%d \"%s\" on \"%s\"",
+		up->fddev, device, id);
+#else 
 	sprintf(device, DEVICE, unit);
 	up->fddev = open(device, O_RDWR, 0777);
-	if (up->fddev <= 0) {
+	if (up->fddev < 0) {
 		msyslog(LOG_ERR,
 		    "refclock_atom: %s: %m", device);
 		return (0);
 	}
+#endif
 
 	/*
 	 * Light off the PPSAPI interface.
@@ -222,9 +239,11 @@
 	pp = peer->procptr;
 	up = (struct ppsunit *)pp->unitptr;
 #ifdef HAVE_PPSAPI
+#ifndef PPS_HAVE_FINDSOURCE
 	if (up->fddev > 0)
 		close(up->fddev);
 	if (up->handle != 0)
+#endif
 		time_pps_destroy(up->handle);
 #endif /* HAVE_PPSAPI */
 	if (pps_peer == peer)
@@ -275,8 +294,13 @@
 
 	pp = peer->procptr;
 	up = (struct ppsunit *)pp->unitptr;
+#ifdef PPS_HAVE_FINDSOURCE
+	if (up->fddev < 0)
+		return 0;
+#else
 	if (up->handle == 0)
 		return (0);
+#endif
 
 	if (time_pps_getcap(up->handle, &capability) < 0) {
 		msyslog(LOG_ERR,
@@ -284,7 +308,7 @@
 		return (0);
 	}
 	memset(&up->pps_params, 0, sizeof(pps_params_t));
-	up->pps_params.api_version = PPS_API_VERS_1;
+	up->pps_params.api_version = PPS_API_VERS;
 	up->pps_params.mode = mode | PPS_TSFMT_TSPEC;
 	if (time_pps_setparams(up->handle, &up->pps_params) < 0) {
 		msyslog(LOG_ERR,
@@ -345,8 +369,13 @@
 	 */ 
 	pp = peer->procptr;
 	up = (struct ppsunit *)pp->unitptr;
+#ifdef PPS_HAVE_FINDSOURCE
+	if (up->fddev < 0)
+		return;
+#else
 	if (up->handle == 0)
 		return;
+#endif
 
 	timeout.tv_sec = 0;
 	timeout.tv_nsec = 0;


