1 // Regression test for bug 379841 - nsIZipReader's last modified time ignores seconds
3 const Cc = Components.classes;
4 const Ci = Components.interfaces;
5 const path = "modules/libjar/test/unit/data/test_bug379841.zip";
6 // Retrieved time should be within 2 seconds of original file's time.
7 const MAX_TIME_DIFF = 2000000;
9 var ENTRY_NAME = "test";
10 // Actual time of file was 07 May 2007 14:35:49
11 var ENTRY_TIME = new Date(2007, 4, 7, 14, 35, 49, 0);
14 var file = do_get_file(path);
15 var zipReader = Cc["@mozilla.org/libjar/zip-reader;1"].
16 createInstance(Ci.nsIZipReader);
18 var entry = zipReader.getEntry(ENTRY_NAME);
19 var diff = Math.abs(entry.lastModifiedTime - ENTRY_TIME.getTime()*1000);
21 if (diff >= MAX_TIME_DIFF)