Fix bug in parsing dates that fall in the DST "non existant hour"
ClosedPublic

Authored by aacid on Jan 31 2018, 11:16 PM.

Details

Summary

The old code was creating a datetime from maybeDate + maybeTime
but that meant that it could be creating a datetime that never
existed if that datetime falls in the time that jumps to the
future when doing dst (i.e 2->3 am)

Test Plan

Added new test that fails without my patch and works with it

Diff Detail

Repository
R180 PIM: KMime
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aacid created this revision.Jan 31 2018, 11:16 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 31 2018, 11:16 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
aacid requested review of this revision.Jan 31 2018, 11:16 PM

+1, but as discussed on IRC, the test is unfortunately local-timezone-dependent (the old code only fails if 31 Mar 2013 02:29 is a non-existent timestamp in the local timezone). Does anyone have an idea to avoid that? The test without the fix should fail regardless of local environment...

dvratil added a subscriber: vkrause.

Looks good to me. Regarding the autotest timezone, that's a common issue in kcalcore tests as well, many of those force the timezone via something like qputenv("TZ", "Europe/Zurich");.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 2 2018, 11:49 PM
This revision was automatically updated to reflect the committed changes.
aacid added a comment.Feb 2 2018, 11:52 PM

guys, i've pushed this by mistake.

Was running the script to update versions of repos to 17.12.2 and it ended up commiting this too.

Do you want me to revert it or is it ok?

guys, i've pushed this by mistake.

Was running the script to update versions of repos to 17.12.2 and it ended up commiting this too.

Do you want me to revert it or is it ok?

No problem, the patch is fine. We can add the forced timezone in a second step.