On Thu, 25 Nov 2021 10:55:45 GMT, Andrew Leonard <aleon...@openjdk.org> wrote:

> Please consider providing a more general option, say `--date`, which takes an 
> [ISO 8601 date/time 
> string](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/format/DateTimeFormatter.html#ISO_DATE_TIME).

The `jar` and `jmod` tools will need to truncate, restrict, or convert the time 
zone and fractional seconds permitted by the ISO 8601 date and time format.

The only way I found to store a timestamp using the methods of 
`java.util.zip.ZipEntry` that was independent of the system's time zone was by 
passing a local date and time in UTC to `setTimeLocal(LocalDateTime)`, 
truncated to seconds.

You can store a zoned date and time indirectly (in seconds) by adding an extra 
extended timestamp field to each entry with `setLastModifiedTime(FileTime)`. 
Unfortunately, that method also stores the "MS-DOS date and time" as the local 
date and time in the default time zone of the JVM (the time zone of the build 
machine). Furthermore, the extra field added to each entry increases the size 
of the archive.

The beauty of the `SOURCE_DATE_EPOCH` value is that it avoids any confusion in 
its interpretation while providing a straightforward solution to the only users 
ever known to need it.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6481

Reply via email to