Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-ant/build.xml,v
retrieving revision 1.304.2.12
diff -u -r1.304.2.12 build.xml
--- build.xml	28 May 2002 11:50:38 -0000	1.304.2.12
+++ build.xml	31 May 2002 20:39:50 -0000
@@ -1235,6 +1235,7 @@
           <exclude name="${regexp.package}/RegexpTest.java" />
           <exclude name="${optional.package}/AbstractXSLTLiaisonTest.java" />
           <exclude name="${ant.package}/types/AbstractFileSetTest.java" />
+          <exclude name="${ant.package}/types/selectors/BaseSelectorTest.java" />
 
           <!-- helper classes, not testcases -->
           <exclude name="org/example/**" />
Index: docs/manual/CoreTypes/selectors.html
===================================================================
RCS file: /home/cvspublic/jakarta-ant/docs/manual/CoreTypes/Attic/selectors.html,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 selectors.html
--- docs/manual/CoreTypes/selectors.html	27 May 2002 07:11:04 -0000	1.1.2.3
+++ docs/manual/CoreTypes/selectors.html	31 May 2002 20:39:50 -0000
@@ -130,6 +130,18 @@
         </td>
       </tr>
       <tr>
+        <td valign="top">granularity</td>
+        <td valign="top">The number of milliseconds leeway to give before
+          deciding whether a files modification time matches a date. This is
+          needed because not every file system supports tracking the last
+          modified time to the millisecond level. The file will be selected
+          provided the condition could be true were the granularity added or
+          subtracted from the actual time. Default is 0 milliseconds except
+          on Windows systems, where it is 2000 milliseconds (2 seconds).
+        </td>
+        <td valign="top" align="center">No</td>
+      </tr>
+      <tr>
         <td valign="top">when</td>
         <td valign="top">Indicates how to interpret the date, whether
           the files to be selected are those whose last modified times should
@@ -189,7 +201,8 @@
         <td valign="top">The number of milliseconds leeway to give before
           deciding a file is out of date. This is needed because not every
           file system supports tracking the last modified time to the
-          millisecond level. Default is 0 milliseconds.
+          millisecond level. Default is 0 milliseconds except on Windows
+          systems, where it is 2000 milliseconds (2 seconds).
         </td>
         <td valign="top" align="center">No</td>
       </tr>
@@ -203,7 +216,7 @@
 &lt;/fileset&gt;
 </pre></blockquote>
 
-    <p>Selects all the Java source files which were modified in the 
+    <p>Selects all the Java source files which were modified in the
       1.5 release.
     </p>
 
Index: src/main/org/apache/tools/ant/types/selectors/DateSelector.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/DateSelector.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 DateSelector.java
--- src/main/org/apache/tools/ant/types/selectors/DateSelector.java	24 May 2002 23:56:26 -0000	1.1.2.1
+++ src/main/org/apache/tools/ant/types/selectors/DateSelector.java	31 May 2002 20:39:55 -0000
@@ -62,6 +62,7 @@
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.Parameter;
+import org.apache.tools.ant.taskdefs.condition.Os;
 
 /**
  * Selector that chooses files based on their last modified date.
@@ -74,19 +75,24 @@
     private long millis = -1;
     private String dateTime = null;
     private boolean includeDirs = false;
+    private int granularity = 0;
     private int cmp = 2;
     public final static String MILLIS_KEY = "millis";
     public final static String DATETIME_KEY = "datetime";
     public final static String CHECKDIRS_KEY = "checkdirs";
+    public final static String GRANULARITY_KEY = "granularity";
     public final static String WHEN_KEY = "when";
 
     public DateSelector() {
+        if (Os.isFamily("dos")) {
+            granularity = 2000;
+        }
     }
 
     public String toString() {
         StringBuffer buf = new StringBuffer("{dateselector date: ");
         buf.append(dateTime);
-        buf.append("compare: ");
+        buf.append(" compare: ");
         if (cmp == 0) {
             buf.append("before");
         }
@@ -95,6 +101,8 @@
         } else {
             buf.append("equal");
         }
+        buf.append(" granularity: ");
+        buf.append(granularity);
         buf.append("}");
         return buf.toString();
     }
@@ -110,6 +118,13 @@
     }
 
     /**
+     * Returns the millisecond value the selector is set for.
+     */
+    public long getMillis() {
+        return millis;
+    }
+
+    /**
      * Sets the date. The user must supply it in MM/DD/YYYY HH:MM AM_PM
      * format
      *
@@ -147,6 +162,14 @@
     }
 
     /**
+     * Sets the number of milliseconds leeway we will give before we consider
+     * a file not to have matched a date.
+     */
+    public void setGranularity(int granularity) {
+        this.granularity = granularity;
+    }
+
+    /**
      * Sets the type of comparison to be done on the file's last modified
      * date.
      *
@@ -182,6 +205,15 @@
                 else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) {
                     setCheckdirs(Project.toBoolean(parameters[i].getValue()));
                 }
+                else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) {
+                    try {
+                        setGranularity(new Integer(parameters[i].getValue()
+                                ).intValue());
+                    } catch (NumberFormatException nfe) {
+                        setError("Invalid granularity setting " +
+                            parameters[i].getValue());
+                    }
+                }
                 else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
                     TimeComparisons cmp = new TimeComparisons();
                     cmp.setValue(parameters[i].getValue());
@@ -225,13 +257,13 @@
             return true;
         }
         if (cmp == 0) {
-            return (file.lastModified() < millis);
+            return ((file.lastModified() - granularity) < millis);
         }
         else if (cmp == 1) {
-            return (file.lastModified() > millis);
+            return ((file.lastModified() + granularity) > millis);
         }
         else {
-            return (file.lastModified() == millis);
+            return (Math.abs(file.lastModified() -  millis) <= granularity);
         }
     }
 
Index: src/main/org/apache/tools/ant/types/selectors/DependSelector.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/DependSelector.java,v
retrieving revision 1.1
diff -u -r1.1 DependSelector.java
--- src/main/org/apache/tools/ant/types/selectors/DependSelector.java	30 Apr 2002 22:38:35 -0000	1.1
+++ src/main/org/apache/tools/ant/types/selectors/DependSelector.java	31 May 2002 20:39:55 -0000
@@ -61,6 +61,7 @@
 import org.apache.tools.ant.util.IdentityMapper;
 import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Os;
 
 /**
  * Selector that filters files based on whether they are newer than
@@ -80,6 +81,9 @@
     private int granularity = 0;
 
     public DependSelector() {
+        if (Os.isFamily("dos")) {
+            granularity = 2000;
+        }
     }
 
     public String toString() {
@@ -171,6 +175,11 @@
 
         // Determine file whose out-of-dateness is to be checked
         String[] destfiles = map.mapFileName(filename);
+        // If filename does not match the To attribute of the mapper
+        // then filter it out of the files we are considering
+        if (destfiles == null) {
+            return false;
+        }
         // Sanity check
         if (destfiles.length != 1 || destfiles[0] == null) {
             throw new BuildException("Invalid destination file results for "
Index: src/main/org/apache/tools/ant/types/selectors/DepthSelector.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/DepthSelector.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 DepthSelector.java
--- src/main/org/apache/tools/ant/types/selectors/DepthSelector.java	24 May 2002 23:56:26 -0000	1.1.2.1
+++ src/main/org/apache/tools/ant/types/selectors/DepthSelector.java	31 May 2002 20:39:55 -0000
@@ -150,7 +150,7 @@
             setError("You must set at least one of the min or the " +
                     "max levels.");
         }
-        if (max < min) {
+        if (max < min && max > -1) {
             setError("The maximum depth is lower than the minimum.");
         }
     }
Index: src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 FilenameSelector.java
--- src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java	24 May 2002 23:56:26 -0000	1.1.2.2
+++ src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java	31 May 2002 20:39:55 -0000
@@ -187,8 +187,8 @@
     public boolean isSelected(File basedir, String filename, File file) {
         validate();
 
-        return SelectorUtils.matchPath(pattern,filename,
-                casesensitive);
+        return (SelectorUtils.matchPath(pattern,filename,
+                casesensitive) == !(negated));
     }
 
 }
Index: src/main/org/apache/tools/ant/types/selectors/PresentSelector.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/selectors/PresentSelector.java,v
retrieving revision 1.1
diff -u -r1.1 PresentSelector.java
--- src/main/org/apache/tools/ant/types/selectors/PresentSelector.java	30 Apr 2002 22:38:36 -0000	1.1
+++ src/main/org/apache/tools/ant/types/selectors/PresentSelector.java	31 May 2002 20:39:55 -0000
@@ -184,6 +184,11 @@
 
         // Determine file whose existence is to be checked
         String[] destfiles = map.mapFileName(filename);
+        // If filename does not match the To attribute of the mapper
+        // then filter it out of the files we are considering
+        if (destfiles == null) {
+            return false;
+        }
         // Sanity check
         if (destfiles.length != 1 || destfiles[0] == null) {
             throw new BuildException("Invalid destination file results for "
