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

Replace GregorianCalendar with java.time.OffsetDateTime in CurrentTimeUTC #866

Merged

Conversation

venfernand
Copy link
Contributor

Now CurrentTimeUTC uses newer java.time API.
This change also removes unnecessary synchronization on the GregorianCalendar object.

…eUTC

Now CurrentTimeUTC uses newer java.time API.
This change also removes unnecessary synchronization on the GregorianCalendar object.
s/currentTimeMilis/currentTimeMillis/g
add javadoc link to System#currentTimeMillis()
src/freenet/support/CurrentTimeUTC.java Outdated Show resolved Hide resolved
src/freenet/support/CurrentTimeUTC.java Outdated Show resolved Hide resolved
src/freenet/support/CurrentTimeUTC.java Outdated Show resolved Hide resolved
src/freenet/support/CurrentTimeUTC.java Outdated Show resolved Hide resolved
src/freenet/support/CurrentTimeUTC.java Show resolved Hide resolved
java.util.Date default constructor creates a date value,
which has UTC zone offset by default.
This time value comes from System.currentTimeMillis().
LocalDate has additional methods to access parts of the date.
Public methods in the CurrentTimeUTC provide values related to dates only,
therefore using LocalDate there is more natural than OffsetDateTime.
@venfernand
Copy link
Contributor Author

I made changes mentioned in review.
Now it looks better.

I may also create a deprecation PR and remove usages of this class.

@venfernand venfernand requested a review from bertm October 14, 2023 10:27
@ArneBab
Copy link
Contributor

ArneBab commented Oct 14, 2023

I made changes mentioned in review. Now it looks better.

I may also create a deprecation PR and remove usages of this class.

At work we have the policy that every deprecation needs a comment people can copy paste to replace the usage of the deprecated method. I would suggest doing that here, too.

We cannot remove this until there isn’t a single use in plugins.

@bertm bertm mentioned this pull request Oct 14, 2023
Copy link
Contributor

@bertm bertm left a comment

Choose a reason for hiding this comment

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

Looks good to me 🚀

@ArneBab ArneBab merged commit 1aa429b into hyphanet:next Oct 14, 2023
1 check passed
@ArneBab
Copy link
Contributor

ArneBab commented Oct 14, 2023

merged - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants