-
Notifications
You must be signed in to change notification settings - Fork 213
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
Replace GregorianCalendar with java.time.OffsetDateTime in CurrentTimeUTC #866
Conversation
…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()
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.
I made changes mentioned in review. 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. |
There was a problem hiding this 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 🚀
merged - thank you! |
Now
CurrentTimeUTC
uses newerjava.time
API.This change also removes unnecessary synchronization on the
GregorianCalendar
object.