Revert "Make ZipEntryTest time-insensitive"

Test fails:

    junit.framework.AssertionFailedError
    	at junit.framework.TestCase.assertTrue(TestCase.java:201)
    	at libcore.java.util.zip.ZipOutputStreamTest.testPutNextEntryUsingCurrentTime(ZipOutputStreamTest.java:126)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at junit.framework.TestCase.runTest(TestCase.java:176)
    	at junit.framework.TestCase.runBare(TestCase.java:141)
    	at libcore.junit.junit3.TestCaseWithRules.superRunBare(TestCaseWithRules.java:110)
    	at libcore.junit.junit3.TestCaseWithRules.-wrap0(Unknown Source:0)
    	at libcore.junit.junit3.TestCaseWithRules$1.evaluate(TestCaseWithRules.java:66)
    	at dalvik.system.CloseGuardSupport$FailTestWhenResourcesNotClosedRule$1.evaluate(CloseGuardSupport.java:111)
    	at libcore.junit.junit3.TestCaseWithRules.runBare(TestCaseWithRules.java:106)
  libcore.java.util.zip.ZipOutputStreamTest#testPutNextEntryUsingCurrentTime FAIL (EXEC_FAILED)

Bug: 37696493

This reverts commit 27feef25778031d9c1fc330f0cca570ecb17c188.

Change-Id: I7b8d1b976e7f23465522e8b48f41183fcef49252
diff --git a/luni/src/test/java/libcore/java/util/zip/ZipEntryTest.java b/luni/src/test/java/libcore/java/util/zip/ZipEntryTest.java
index f58c8aa..bf10c3e 100644
--- a/luni/src/test/java/libcore/java/util/zip/ZipEntryTest.java
+++ b/luni/src/test/java/libcore/java/util/zip/ZipEntryTest.java
@@ -21,24 +21,16 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.time.temporal.ChronoUnit;
 import java.util.Arrays;
 import java.util.List;
 import java.util.jar.JarEntry;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
 public class ZipEntryTest extends junit.framework.TestCase {
-  // The zip format differentiates between times before and after 1/1/1980. A timestamp before 1980
-  // will produce a different zip binary. ZipOutputStream.putNextEntry defaults the entry times to
-  // the current system clock value. This time can be used explicitly to ensure the behavior of most
-  // tests is independent of the system clock.
-  private static final long ENTRY_TIME = 1262304000000L; //  January 1, 2010 12:00:00 AM GMT
-
   private static File createTemporaryZipFile() throws IOException {
     File result = File.createTempFile("ZipFileTest", "zip");
     result.deleteOnExit();
@@ -142,7 +134,6 @@
     ZipOutputStream out = createZipOutputStream(f);
     ZipEntry ze = new ZipEntry("x");
     ze.setSize(0);
-    ze.setTime(ENTRY_TIME);
     ze.setExtra(maxLengthExtra);
     out.putNextEntry(ze);
     out.closeEntry();
@@ -154,41 +145,6 @@
     zipFile.close();
   }
 
-  public void testSetTime() throws Exception {
-    // Set a time before the lower bound of dos time, year 1980
-    checkSetTime(0L); // January 1, 1970 12:00:00 AM GMT
-    checkSetTime(31536000000L); // January 1, 1971 12:00:00 AM GMT
-    checkSetTime(315187200000L); // December 28, 1979 12:00:00 AM GMT
-    // December 31, 1979 11:59:59 AM Local time
-    checkSetTime(LocalDate.of(1980, 1, 1).atStartOfDay().minus(1, ChronoUnit.SECONDS)
-                    .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
-
-    // January 1, 1980 12:00:00 AM Local time
-    checkSetTime(LocalDate.of(1980, 1, 1).atStartOfDay().atZone(ZoneId.systemDefault())
-            .toInstant().toEpochMilli());
-    // Set a time after the lower bound of dos time, year 1980
-    checkSetTime(315705600000L); // January 3, 1980 12:00:00 AM GMT
-    checkSetTime(ENTRY_TIME); // January 1, 2010 12:00:00 AM
-
-    // Set a time after upper bound of dos time.
-    checkSetTime(4134153600000L); // January 3, 2101 12:00:00 AM GMT
-  }
-
-  private static void checkSetTime(long time) throws IOException {
-    File f = createTemporaryZipFile();
-    ZipOutputStream out = createZipOutputStream(f);
-    ZipEntry ze = new ZipEntry("x");
-    ze.setSize(0);
-    ze.setTime(time);
-    out.putNextEntry(ze);
-    out.closeEntry();
-    out.close();
-
-    // Read it back, and check that we see the entry.
-    ZipFile zipFile = new ZipFile(f);
-    assertEquals(time, zipFile.getEntry("x").getTime());
-    zipFile.close();
-  }
 
   // TODO: This test does not compile because we need to add a ZipOutputStream constructor
   // that forces zip64. This also needs followup changes in ZipInputStream et al. to assume zip64
@@ -250,7 +206,6 @@
     // Regular (non zip64) format.
     ZipEntry ze = new ZipEntry("x");
     ze.setSize(0);
-    ze.setTime(ENTRY_TIME);
     ze.setExtra(extra);
     ze.setComment(comment);
     out.putNextEntry(ze);
@@ -258,7 +213,6 @@
 
     // An entry without a length is assumed to be zip64.
     ze = new ZipEntry("y");
-    ze.setTime(ENTRY_TIME);
     ze.setExtra(extra);
     ze.setComment(comment);
     out.putNextEntry(ze);
diff --git a/luni/src/test/java/libcore/java/util/zip/ZipOutputStreamTest.java b/luni/src/test/java/libcore/java/util/zip/ZipOutputStreamTest.java
index ddac57e..4e72874 100644
--- a/luni/src/test/java/libcore/java/util/zip/ZipOutputStreamTest.java
+++ b/luni/src/test/java/libcore/java/util/zip/ZipOutputStreamTest.java
@@ -17,7 +17,6 @@
 package libcore.java.util.zip;
 
 import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -26,8 +25,6 @@
 import java.util.Random;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 import libcore.junit.junit3.TestCaseWithRules;
 import libcore.junit.util.ResourceLeakageDetector;
@@ -101,30 +98,4 @@
             out.finish();
         }
     }
-
-    /**
-     * Test {@link ZipOutputStream#putNextEntry(ZipEntry)} that the current time will be used
-     * if the entry has no set modification time.
-     */
-    public void testPutNextEntryUsingCurrentTime() throws IOException {
-        long timeBeforeZip = System.currentTimeMillis();
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        try (ZipOutputStream out = new ZipOutputStream(bos)) {
-            ZipEntry entryWithoutExplicitTime = new ZipEntry("name");
-            // We do not set a time on the entry. We expect ZipOutputStream to use the current
-            // system clock value.
-            out.putNextEntry(entryWithoutExplicitTime);
-            out.closeEntry();
-            out.finish();
-        }
-        long timeAfterZip = System.currentTimeMillis();
-
-        // Read it back, and check the modification time is almost the system clock value
-        try (ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(bos.toByteArray()))) {
-            ZipEntry entry = zis.getNextEntry();
-            assertEquals("name", entry.getName());
-            assertTrue(timeBeforeZip <= entry.getTime());
-            assertTrue(timeAfterZip >= entry.getTime());
-        }
-    }
 }