On Tue, 30 Nov 2021 19:37:23 GMT, Andrew Leonard <aleon...@openjdk.org> wrote:

> Whichever we use, we have to use e.setTimeLocal(), so can't see what the 
> difference is?

Okay, here's a brief command-line example before posting the code example. In 
my experience, most people trying to set up a common, project-wide build 
timestamp use the formatted string in UTC:


$ date -d @$SOURCE_DATE_EPOCH --iso-8601=seconds --utc
2021-11-29T17:36:06+00:00


In JavaFX, we're using the more concise Java version of that string: 
`2021-11-29T17:36:06Z`.

So here's what happens when you get that exact same instant in time from 
different sources on different machines:


$ TZ=America/Nome date -d @$SOURCE_DATE_EPOCH --iso-8601=seconds
2021-11-29T08:36:06-09:00
$ TZ=Europe/Rome date -d @$SOURCE_DATE_EPOCH --iso-8601=seconds
2021-11-29T18:36:06+01:00
$ git log -1 --pretty=%cI
2021-11-29T09:36:06-08:00


All of a sudden it makes a big difference when you're discarding the time zone. 
You end up with differences in the archive files depending on (a) the time zone 
of the build machine, and (b) the source you use to obtain an ISO 8601 string 
to represent that singular instant.

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

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

Reply via email to