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

Fixed failing of lysp_check_date when using DST configurations with savingtimes >=24h #2310

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

Troltsch
Copy link

Disabled DST by setting tm_isdst to -1 so that mktime() won't adjust for daylight saving time.
This is especially important for custom DST settings.
Without this fix lysp_check_date() fails due to if (tm.tm_mday != tm_.tm_mday)

This bug can be reproduced i.e. by creating a custom DST like this one:

# Rule NAME    FROM    TO      -   IN   ON      AT    SAVE    LETTER/S
Rule   Custom  2020    max     -   Oct  1       0:00  25:00       S
Rule   Custom  2020    max     -   May  1       0:00  0         -

# Zone NAME    GMT_offset  RULES/SAVE  FORMAT   [UNTIL]
Zone  Custom/TZ    1:00   Custom       C%sT
  1. Create the custom_timezone.txt
  2. Compile the TZ file: zic custom_timezone.txt
  3. Copy the custom TZ to /etc/localtime: cp /usr/share/zoneinfo/Custom/TZ /etc/localtime
  4. Change the TZ i.e. with export TZ="Custom/TZ"
  5. See that date and date -u have different days due to the insane DST configuration.
  6. Run the tests and observe all of them failing without the fix.

Also this fix is compatible with the previous issue when using TZ "Europe/Dublin".

…for daylight saving time.

This is especially important for custom DST settings
@Troltsch
Copy link
Author

Regression tests passed successfully, before and after implementing the fix.

I know this PR seems over the top but I actually had a bug in one of my projects because one of the IETF yang models allowed a range of 1 to 1440 minutes for the recurring offset.

@michalvasko
Copy link
Member

It does seem unnecessary but the fix should also not cause any issues, so it can be merged.

@michalvasko michalvasko merged commit cf919b8 into CESNET:devel Oct 14, 2024
13 checks passed
@Troltsch Troltsch deleted the fix-dst-in-check-date branch October 14, 2024 08:10
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 this pull request may close these issues.

2 participants