Skip to content

Commit 7ed87d1

Browse files
authored
PR #603: pass CreateZip tests that are within time tolerance
1 parent 4cb5853 commit 7ed87d1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,10 @@ public void CreateZipShouldSetTimeOnEntriesFromConstructorTimeSetting(TimeSettin
725725
var archive = new MemoryStream(target.ToArray());
726726
using (var zf = new ZipFile(archive))
727727
{
728-
Assert.AreEqual(TestTargetTime(timeSetting), zf[0].DateTime);
728+
var expectedTime = TestTargetTime(timeSetting);
729+
var actualTime = zf[0].DateTime;
730+
// Assert that the time is within +/- 2s of the target time to allow for timing/rounding discrepancies
731+
Assert.LessOrEqual(Math.Abs((expectedTime - actualTime).TotalSeconds), 2);
729732
}
730733
}
731734

0 commit comments

Comments
 (0)