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
This commit is contained in:
Shawn Pearce 2017-02-20 10:30:58 -08:00
parent fceac7e44d
commit ff6e6c2214
1 changed files with 3 additions and 3 deletions

View File

@ -109,9 +109,9 @@ public void putEntry(ArchiveOutputStream out,
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) {