Skip to content

Conversation

@raboof
Copy link
Member

@raboof raboof commented Aug 23, 2023

Show the 'current' year in the projectTimespan (used for example in https://github.com/apache/maven-apache-resources/blob/master/jar/src/main/resources/META-INF/NOTICE.vm#L21 ) in UTC.

By default, SimpleDateFormat formats the java.util.Date (which does not carry a timezone) in the 'current' timezone. This is not reproducible, as when project.build.outputTimestamp is set to a time close to new years', two builds in different timezones may produce a different year.

This change makes sure the year is shown in UTC. This especially makes sense when project.build.outputTimestamp is given in seconds since epoch, since epoch is defined to be given relative to 00:00:00 UTC on Thursday, 1 January 1970. It is also likely the most common timezone when specifying project.build.outputTimestamp as a date.

I did not introduce a new unit test to test this behaviour, but I did update an existing test to be more likely to fail in this case (specifically, when building with for example TZ=GMT-7).

Show the 'current' year in the `projectTimespan` (used for example in
https://github.com/apache/maven-apache-resources/blob/master/jar/src/main/resources/META-INF/NOTICE.vm#L21 ) in UTC.

By default, `SimpleDateFormat` formats the `java.util.Date` (which does not
carry a timezone) in the 'current' timezone. This is not reproducible, as when
`project.build.outputTimestamp` is set to a time close to new years', two
builds in different timezones may produce a different year.

This change makes sure the year is shown in UTC. This especially makes sense
when `project.build.outputTimestamp` is given in seconds since epoch, since
epoch is defined to be given relative to 00:00:00 UTC on Thursday, 1 January
1970. It is also likely the most common timezone when specifying
`project.build.outputTimestamp` as a date.

I did not introduce a new unit test to test this behaviour, but I did update
an existing test to be more likely to fail in this case (specifically, when
building with for example `TZ=GMT-7`).
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch looks good.

@slawekjaranowski slawekjaranowski changed the title Show projectTimespan year in UTC [MRRESOURCES-135] Show projectTimespan year in UTC Aug 28, 2023
@slawekjaranowski slawekjaranowski merged commit c663e69 into apache:master Aug 28, 2023
@slawekjaranowski slawekjaranowski added the bug Something isn't working label Sep 4, 2023
@slawekjaranowski slawekjaranowski added this to the 3.2.0 milestone Feb 26, 2024
@jira-importer
Copy link

Resolve #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants