bodewig     2003/01/28 01:12:12

  Modified:    src/main/org/apache/tools/ant/taskdefs Zip.java
               src/main/org/apache/tools/zip ZipOutputStream.java
  Log:
  Move the 'round up to next even second' logic to where it belongs -> out of 
the library and into the task
  
  Revision  Changes    Path
  1.90      +6 -3      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Zip.java  23 Jan 2003 15:03:29 -0000      1.89
  +++ Zip.java  28 Jan 2003 09:12:12 -0000      1.90
  @@ -824,9 +824,11 @@
           if (! skipWriting) {
               ZipEntry ze = new ZipEntry (vPath);
               if (dir != null && dir.exists()) {
  -                ze.setTime(dir.lastModified());
  +                // ZIPs store time with a granularity of 2 seconds, round up
  +                ze.setTime(dir.lastModified() + 1999);
               } else {
  -                ze.setTime(System.currentTimeMillis());
  +                // ZIPs store time with a granularity of 2 seconds, round up
  +                ze.setTime(System.currentTimeMillis() + 1999);
               }
               ze.setSize (0);
               ze.setMethod (ZipEntry.STORED);
  @@ -957,7 +959,8 @@
   
           FileInputStream fIn = new FileInputStream(file);
           try {
  -            zipFile(fIn, zOut, vPath, file.lastModified(), null, mode);
  +            // ZIPs store time with a granularity of 2 seconds, round up
  +            zipFile(fIn, zOut, vPath, file.lastModified() + 1999, null, 
mode);
           } finally {
               fIn.close();
           }
  
  
  
  1.11      +2 -2      
jakarta-ant/src/main/org/apache/tools/zip/ZipOutputStream.java
  
  Index: ZipOutputStream.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/zip/ZipOutputStream.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ZipOutputStream.java      22 Jan 2003 13:33:24 -0000      1.10
  +++ ZipOutputStream.java      28 Jan 2003 09:12:12 -0000      1.11
  @@ -653,7 +653,7 @@
               |         (time.getDate() << 16)
               |         (time.getHours() << 11)
               |         (time.getMinutes() << 5)
  -            |         ((time.getSeconds() + 2) >> 1);
  +            |         (time.getSeconds() >> 1);
           
           byte[] result = new byte[4];
           result[0] = (byte) ((value & 0xFF));
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to