Skip to content

Commit

Permalink
[MSHADE-471] deal with DST
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Apr 14, 2024
1 parent 58d8cfe commit 7de9ae7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
Expand All @@ -43,7 +44,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
Expand Down Expand Up @@ -102,7 +102,9 @@ private long getTime(ZipEntry entry) {
for (ZipExtraField field : fields) {
if (X5455_ExtendedTimestamp.HEADER_ID.equals(field.getHeaderId())) {
// extended timestamp extra field: need to translate UTC to local time for Reproducible Builds
return entry.getTime() - TimeZone.getDefault().getRawOffset();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(entry.getTime());
return entry.getTime() - (cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET));
}
}
} catch (ZipException ze) {
Expand Down

0 comments on commit 7de9ae7

Please sign in to comment.