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

Invalid TIMESTAMP to java.util.Calendar parsing #339

Closed
rgmih opened this issue Mar 17, 2017 · 0 comments
Closed

Invalid TIMESTAMP to java.util.Calendar parsing #339

rgmih opened this issue Mar 17, 2017 · 0 comments

Comments

@rgmih
Copy link

rgmih commented Mar 17, 2017

Value of type TIMESTAMP WITH TIME ZONE is being incorrectly parsed to java.util.Calendar.

The problem is in PgDateSupportUtils.parseCalendar function. Line

useCal.set(Calendar.MILLISECOND, nanos.get(parsedts).asInstanceOf[Int] / 1000)

sets Calendar.MILLISECOND field to number of MICROseconds. So that resulting Calendar value is wrong — it differs from original value by few minutes (depending on actual nanos value). The line should be

useCal.set(Calendar.MILLISECOND, nanos.get(parsedts).asInstanceOf[Int] / 1000000)

instead.

I have patched 0.14.6 and checked fix in local environment.
Hope 0.14.7 could be released with given fix.

@rgmih rgmih changed the title Invalid java.util.Calendar parsing Invalid TIMESTAMP to java.util.Calendar parsing Mar 17, 2017
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

No branches or pull requests

1 participant