diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/configure wfdb-10.5.17/configure
--- wfdb-10.5.16/configure	2012-08-12 10:56:27.000000000 -0400
+++ wfdb-10.5.17/configure	2013-01-02 18:22:11.000000000 -0500
@@ -1,6 +1,6 @@
 #! /bin/sh
 # file: configure             G. Moody         24 May 2000
-#                             Last revised:  18 February 2011
+#                             Last revised:   2 January 2013
 # Configuration script for the WFDB Software Package
 
 # This script was not generated using 'autoconf'.  If you can implement
@@ -456,9 +456,8 @@
     sed "s/WFDBRELEASE/$RELEASE/" | \
     sed "s/WFDB_NETFILES_LIBCURL 1/WFDB_NETFILES_LIBCURL $NETFILES_LIBCURL/" \
       >../lib/wfdb.h
-if [ $LIBTYPE = "static" -a $NETLIB != "none" ]
+if [ $NETLIB != "none" ]
     then
-    LL = "$LL $LL $LL"
     sed "s/LC =/LC = $LC/" <site.def | sed "s/LL =/LL = $LL/" >site.tmp
     mv site.tmp site.def
 fi
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/convert/wfdb2mat.c wfdb-10.5.17/convert/wfdb2mat.c
--- wfdb-10.5.16/convert/wfdb2mat.c	2010-11-29 11:01:10.000000000 -0500
+++ wfdb-10.5.17/convert/wfdb2mat.c	2013-01-02 17:54:06.000000000 -0500
@@ -1,8 +1,8 @@
 /* file: wfdb2mat.c	G. Moody	26 February 2009
-			Last revised:	29 November 2010
+			Last revised:	 2 January 2013
 -------------------------------------------------------------------------------
 wfdb2mat: Convert (all or part of) a WFDB signal file to Matlab .mat format
-Copyright (C) 2009-2010 George B. Moody
+Copyright (C) 2009-2013 George B. Moody
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -219,7 +219,6 @@
 	(void)fprintf(stderr, "%s: can't read signal '%s'\n", pname, search);
 	exit(2);
     }
-
     /* Reset 'to' if a duration limit was specified. */
     if (maxl > 0L && (maxl = strtim(argv[maxl])) < 0L)
 	maxl = -maxl;
@@ -318,7 +317,9 @@
     }
 
     /* Create the new header file. */
+    setbasetime(mstimstr(-from)+1);
     newheader(orec);
+
     /* Copy info from the old record, if any */
     if (p = getinfo(NULL))
 	do {
@@ -329,7 +330,7 @@
     (void)sprintf(p, "Creator: %s", pname);
     (void)putinfo(p);
     (void)sprintf(p, "Source: record %s", record);
-    q = mstimstr(-from);
+    q = mstimstr(0);
     while (*q == ' ') q++;
     if (from != 0 || *q == '[') {
 	strcat(p, "  Start: ");
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wag-src/wag.ht0 wfdb-10.5.17/doc/wag-src/wag.ht0
--- wfdb-10.5.16/doc/wag-src/wag.ht0	2012-04-09 12:01:02.000000000 -0400
+++ wfdb-10.5.17/doc/wag-src/wag.ht0	2013-01-02 17:52:51.000000000 -0500
@@ -20,7 +20,7 @@
 George B. Moody<BR> 
 Harvard-MIT Division of Health Sciences and Technology</STRONG></P><P>
 <P>
-Copyright &#169;1980-2012 George B. Moody
+Copyright &#169;1980-2013 George B. Moody
 <P>
 The most recent versions of the programs described in this guide may be freely
 downloaded from <A HREF="http://www.physionet.org/">PhysioNet</A>.  For
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wag-src/wag.tex wfdb-10.5.17/doc/wag-src/wag.tex
--- wfdb-10.5.16/doc/wag-src/wag.tex	2012-04-09 12:01:07.000000000 -0400
+++ wfdb-10.5.17/doc/wag-src/wag.tex	2013-01-02 17:52:46.000000000 -0500
@@ -36,7 +36,7 @@
 \pagestyle{empty}
 \vspace*{\fill}
 \noindent
-Copyright \copyright 1980 -- 2012 George B. Moody
+Copyright \copyright 1980 -- 2013 George B. Moody
 
 \vspace{1 in}
 \noindent
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wag-src/wfdb-config.1 wfdb-10.5.17/doc/wag-src/wfdb-config.1
--- wfdb-10.5.16/doc/wag-src/wfdb-config.1	2004-12-13 23:47:11.000000000 -0500
+++ wfdb-10.5.17/doc/wag-src/wfdb-config.1	2013-01-02 01:45:14.000000000 -0500
@@ -1,4 +1,4 @@
-.TH WFDB-CONFIG 1 "1 August 2002" "WFDB 10.2.7" "WFDB Applications Guide"
+.TH WFDB-CONFIG 1 "2 January 2013" "WFDB 10.5.17" "WFDB Applications Guide"
 .SH NAME
 wfdb-config \- print WFDB library version and configuration info
 .SH SYNOPSIS
@@ -32,4 +32,4 @@
 .SH AUTHOR
 George B. Moody (george@mit.edu)
 .SH SOURCE
-http://www.physionet.org/physiotools/wfdb/lib/wfdb-config.c
+http://www.physionet.org/physiotools/wfdb/app/wfdb-config.c
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wpg-src/wpg0.tex wfdb-10.5.17/doc/wpg-src/wpg0.tex
--- wfdb-10.5.16/doc/wpg-src/wpg0.tex	2012-09-27 10:17:51.000000000 -0400
+++ wfdb-10.5.17/doc/wpg-src/wpg0.tex	2013-01-02 17:51:05.000000000 -0500
@@ -21,7 +21,7 @@
 @center Harvard-MIT Division of Health Sciences and Technology
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1980 -- 2012 George B. Moody
+Copyright @copyright{} 1980 -- 2013 George B. Moody
 @sp 2
 The most recent versions of the software described in this guide may be
 downloaded from @uref{http://physionet.org/}.
@@ -9051,6 +9051,24 @@
 
 @unnumberedsec WFDB 10.5
 
+@unnumberedsubsec Changes in version 10.5.17 (2 January 2013)
+
+The WFDB library internal function @code{wfdb_addtopath()} (in
+@file{lib/wfdbio.c}) adds the path component of its string argument (i.e.,
+everything except the file name itself) to the WFDB path, inserting it there if
+it is not already in the path.  This function is called by another WFDB library
+internal function, @code{wfdb_open()}, which finds and opens files for all
+other WFDB library functions that open files; @code{wfdb_open()} passes the
+paths of files it successfully opens to @code{wfdb_addtopath()}, permitting
+other files in the same locations to be found.  In previous releases,
+@code{wfdb_addtopath()} appended the new path component to the end of the WFDB
+path.  As originally noted by David Brooks, this is suboptimal since the files
+comprising a given record are most often kept in the same directory.  In this
+release, the new component is inserted at the head of the path, or as the
+second path component if @code{"."} (the current directory) is the first
+component, thus improving the likelihood that subsequent files to be opened
+will be found in the first or second location @code{wfdb_open()} checks.
+
 @unnumberedsubsec Changes in version 10.5.16 (27 September 2012)
 
 A bug in WFDB library versions 10.5.11 through 10.5.15 resulted in an attempt
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wpg-src/wpg.ht0 wfdb-10.5.17/doc/wpg-src/wpg.ht0
--- wfdb-10.5.16/doc/wpg-src/wpg.ht0	2012-04-09 12:01:45.000000000 -0400
+++ wfdb-10.5.17/doc/wpg-src/wpg.ht0	2013-01-02 17:51:46.000000000 -0500
@@ -19,7 +19,7 @@
 George B. Moody<BR> 
 Harvard-MIT Division of Health Sciences and Technology<BR></STRONG></P><P>
 <P>
-Copyright &#169;1980-2012 George B. Moody.
+Copyright &#169;1980-2013 George B. Moody.
 <P>
 The most recent versions of the software described in this guide are freely
 downloadable from <A HREF="http://www.physionet.org/">PhysioNet</A>.  For
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/doc/wug-src/wug0.tex wfdb-10.5.17/doc/wug-src/wug0.tex
--- wfdb-10.5.16/doc/wug-src/wug0.tex	2012-04-09 12:02:15.000000000 -0400
+++ wfdb-10.5.17/doc/wug-src/wug0.tex	2013-01-02 17:53:17.000000000 -0500
@@ -57,7 +57,7 @@
 \pagestyle{empty}
 \vspace*{\fill}
 \noindent
-Copyright \copyright 1992 -- 2012 George B. Moody
+Copyright \copyright 1992 -- 2013 George B. Moody
 
 \vspace{1 in}
 \noindent
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/lib/wfdb.h wfdb-10.5.17/lib/wfdb.h
--- wfdb-10.5.16/lib/wfdb.h	2012-09-27 10:19:13.000000000 -0400
+++ wfdb-10.5.17/lib/wfdb.h	2013-01-02 18:25:57.000000000 -0500
@@ -32,7 +32,7 @@
 /* WFDB library version. */
 #define WFDB_MAJOR   10
 #define WFDB_MINOR   5
-#define WFDB_RELEASE 16
+#define WFDB_RELEASE 17
 #define WFDB_NETFILES 1	/* if 1, library includes code for HTTP, FTP clients */
 #define WFDB_NETFILES_LIBCURL 1
 
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/lib/wfdbio.c wfdb-10.5.17/lib/wfdbio.c
--- wfdb-10.5.16/lib/wfdbio.c	2012-08-13 15:21:53.000000000 -0400
+++ wfdb-10.5.17/lib/wfdbio.c	2013-01-02 18:23:01.000000000 -0500
@@ -1,10 +1,10 @@
 /* file: wfdbio.c	G. Moody	18 November 1988
-                        Last revised:	 13 August 2012       wfdblib 10.5.14
+                        Last revised:	 2 January 2013       wfdblib 10.5.17
 Low-level I/O functions for the WFDB library
 
 _______________________________________________________________________________
 wfdb: a library for reading and writing annotated waveforms (time series data)
-Copyright (C) 1988-2012 George B. Moody
+Copyright (C) 1988-2013 George B. Moody
 
 This library is free software; you can redistribute it and/or modify it under
 the terms of the GNU Library General Public License as published by the Free
@@ -347,7 +347,7 @@
 
 struct wfdb_path_component {
     char *prefix;
-    struct wfdb_path_component *next;
+    struct wfdb_path_component *next, *prev;
     int type;		/* WFDB_LOCAL or WFDB_NET */
 };
 static struct wfdb_path_component *wfdb_path_list;
@@ -509,6 +509,7 @@
 	SALLOC(c1->prefix, q-p+1, sizeof(char));
 	memcpy(c1->prefix, p, q-p);
 	c1->type = current_type;
+	c1->prev = c0;
 	if (c0) c0->next = c1;
 	else wfdb_path_list = c1;
 	c0 = c1;
@@ -609,24 +610,31 @@
 }
 #endif
 
-/* wfdb_addtopath appends the path component of its string argument (i.e.
-everything except the file name itself) to the end of the WFDB path, provided
-that the WFDB path does not already contain this component.  This function is
-invoked by readheader() (in signal.c) for each signal file name read.
-
-The intent is to permit the use of a relatively short WFDB path, even when
-using many databases.  If header files are collected into a few directories,
-and absolute pathnames for the signal files are entered within them, annotation
-files stored in the same directories as the signal files will also be
-accessible even if those directories are not listed explicitly in the WFDB
-path.  This feature may be particularly useful to MS-DOS users because of that
-system's limit on the length of environment variables. */
+/* wfdb_addtopath adds the path component of its string argument (i.e.
+everything except the file name itself) to the WFDB path, inserting it
+there if it is not already in the path.  If the first component of the WFDB
+path is '.' (the current directory), the new component is moved to the second
+position; otherwise, it is moved to the first position.
+
+wfdb_open calls this function whenever it finds and opens a file.
+
+Since the files comprising a given record are most often kept in the
+same directory, this strategy improves the likelihood that subsequent
+files to be opened will be found in the first or second location wfdb_open
+checks.
+
+If the current directory (.) is at the head of the WFDB path, it remains there,
+so that wfdb_open will continue to find the user's own files in preference to
+like-named files elsewhere in the path.  If this behavior is not desired, the
+current directory should not be specified initially as the first component of
+the WFDB path.
+ */
 
 void wfdb_addtopath(char *s)
 {
     char *p, *t;
     int i, len;
-    struct wfdb_path_component *c0;
+    struct wfdb_path_component *c0, *c1;
 
     if (s == NULL || *s == '\0') return;
 
@@ -641,27 +649,44 @@
        included in the path component, but in this case there is nothing
        else to include. */
 
-    if (p == s && (*p == '/' || *p == '\\' || *p == ';')) p++;
+    if (p == s && (*p == '/' || *p == '\\' || *p == ':')) p++;
 
     if (p < s) return;		/* argument did not contain a path component */
 
     /* If p > s, then p points to the first character following the path
        component of s. Search the current WFDB path for this path component. */
     if (wfdbpath == NULL) (void)getwfdb();
-    for (c0 = wfdb_path_list, i = p-s; c0; c0 = c0->next)
-	if (strncmp(c0->prefix, s, i) == 0)
-	    return;	/* path component of s is already in WFDB path */
-
-    /* If we've come this far, the path component of s was not found in the
-       current WFDB path;  now append it. */
-    len = strlen(wfdbpath); 	/* wfdbpath set by getwfdb() -- see above */
-    SUALLOC(t, 1, len + i + 2);
-    (void)strcpy(t, wfdbpath);
-    t[len++] = PSEP;		/* append a path separator */
-    (void)strncpy(t+len, s, i); 	/* append the new path component */
-    t[len+i] = '\0';
-    setwfdb(t);
-    SFREE(t);
+    for (c0 = c1 = wfdb_path_list, i = p-s; c1; c1 = c1->next) {
+	if (strncmp(c1->prefix, s, i) == 0) {
+	    if (c0 == c1 || (c1->prev == c0 && strcmp(c0->prefix, ".") == 0))
+		return; /* no changes needed, quit */
+	    /* path component of s is already in WFDB path -- unlink its node */
+	    if (c1->next) (c1->next)->prev = c1->prev;
+	    if (c1->prev) (c1->prev)->next = c1->next;
+	    break;
+	}
+    }
+    if (!c1) {
+	/* path component of s not in WFDB path -- make a new node for it */
+ 	SUALLOC(c1, 1, sizeof(struct wfdb_path_component));
+	SALLOC(c1->prefix, p-s+1, sizeof(char));
+	memcpy(c1->prefix, s, p-s);
+	if (strstr(c1->prefix, "://")) c1->type = WFDB_NET;
+	else c1->type = WFDB_LOCAL;
+    }
+    /* (Re)link the unlinked node. */
+    if (strcmp(c0->prefix, ".") == 0) {  /* skip initial "." if present */
+	c1->prev = c0;
+	c1->next = c0->next;
+	(c1->next)->prev = c0->next = c1;
+    }	
+    else { /* no initial ".";  insert the node at the head of the path */ 
+	wfdb_path_list = c1;
+	c1->prev = NULL;
+	c1->next = c0;
+	c0->prev = c1;
+    }
+    return;
 }
 
 /* The wfdb_error function handles error messages, normally by printing them
diff -Naur --exclude Makefile --exclude info wfdb-10.5.16/NEWS wfdb-10.5.17/NEWS
--- wfdb-10.5.16/NEWS	2012-10-05 09:51:26.363689108 -0400
+++ wfdb-10.5.17/NEWS	2013-01-02 18:33:24.864448257 -0500
@@ -1,3 +1,34 @@
+10.5.17 (2 January 2013):
+	A small change in the 'configure' script works around a problem
+	in building WFDB applications on recent versions of Debian and
+	Ubuntu GNU/Linux.  The solution was first described in conf/linux.def
+	(version 10.3.17, August 2005, and in all later versions) but it was
+	not implemented by default since it was not needed at the time, and
+	because it complicated the process of building 32-bit applications on
+	64-bit platforms. 
+
+	In previous releases, wfdb2mat did not correctly report the time of the
+	beginning of its output unless the conversion started at the beginning
+	of its input.  This problem has been fixed in this release; thanks to
+	Mayela Zamora for reporting the problem.
+
+	The WFDB library internal function wfdb_addtopath() (in lib/wfdbio.c)
+	adds the path component of its string argument (i.e., everything except
+	the file name itself) to the WFDB path, inserting it there if it is not
+	already in the path.  This function is called by another WFDB library
+	internal function, wfdb_open(), which finds and opens files for all
+	other WFDB library functions that open files; wfdb_open() passes the
+	paths of files it successfully opens to wfdb_addtopath(), permitting
+	other files in the same locations to be found.  In previous releases,
+	wfdb_addtopath() appended the new path component to the end of the WFDB
+	path.  As originally noted by David Brooks, this is suboptimal since
+	the files comprising a given record are most often kept in the same
+	directory.  In this release, the new component is inserted at the head
+	of the path, or as the second path component if "." (the current
+	directory) is the first component, thus improving the likelihood that
+	subsequent files to be opened will be found in the first or second
+	location wfdb_open() checks.
+
 10.5.16 (27 September 2012):
 	A bug in WFDB library versions 10.5.13 through 10.5.15 resulted in
         an attempt to close an already-closed header file after invoking
