From ff6e6c2214dc4b68e6754c3d1a8fc964ad6eab41 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Mon, 20 Feb 2017 10:30:58 -0800 Subject: Fix timestamp in Zip archives RevCommit.getCommitTime returns time in seconds since the epoch. ZipArchiveEntry.setTime expects time in milliseconds. Add the missing unit conversion to get the correct result. Correct formatting to be consistent with the rest of the code. Change-Id: I990b92f1d996ec8538d4857755694d91b142eb53 --- .../src/org/eclipse/jgit/archive/ZipFormat.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'org.eclipse.jgit.archive/src/org/eclipse/jgit') diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java index 7cce19702c..46d918ed70 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java @@ -109,9 +109,9 @@ public final class ZipFormat extends BaseFormat implements final ZipArchiveEntry entry = new ZipArchiveEntry(path); - if(tree instanceof RevCommit){ - long commitTime = ((RevCommit) tree).getCommitTime(); - entry.setTime(commitTime); + if (tree instanceof RevCommit) { + long t = ((RevCommit) tree).getCommitTime() * 1000L; + entry.setTime(t); } if (mode == FileMode.TREE) { -- cgit v1.2.3