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

DateAndTime to/from DATETIME is inconsistent #9

Open
rko281 opened this issue Apr 6, 2020 · 0 comments · May be fixed by #10
Open

DateAndTime to/from DATETIME is inconsistent #9

rko281 opened this issue Apr 6, 2020 · 0 comments · May be fixed by #10

Comments

@rko281
Copy link
Contributor

rko281 commented Apr 6, 2020

The unit test MySQLStatementReadTest>>testReadTimeTypes was previously running correctly in GMT timezone but now errors following the move to daylight saving time.

The cause looks to be the mapping of DateAndTime to/from DATETIME values. When converting to DATETIME the DateAndTime representation in the local timezone is used; this implicitly includes the local offset (the DATETIME representation does not include an offset). When converting back to a DateAndTime in MySQLBinaryReader>>dateTimeFrom: a zero offset is applied resulting in a different DateAndTime.

Note that MySQLStatementReadTest>>testReadTimeTypes only fails on the first attempt; subsequent runs succeed due to the test permanently changing the image's localTimeZone to TimeZone default (UTC).

Suggest changing MySQLBinaryReader>>dateTimeFrom: to apply the localTimeZone's offset instead of zero.

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 a pull request may close this issue.

1 participant