Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRRESOURCES-135] Show projectTimespan year in UTC #39

Merged
merged 1 commit into from Aug 28, 2023

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
7 checks passed
@slawekjaranowski slawekjaranowski added this to the 3.2.0 milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants