Skip to content

DateAndTime to/from DATETIME is inconsistent #9

Open
@rko281

Description

@rko281

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions