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

Correct getMySQLTimezoneOffset() to not round timezones and cut off minutes #4827

Closed
wants to merge 1 commit into from

Conversation

danny6167
Copy link
Member

The current version of getMySQLTimezoneOffset() assumes that all timezones are whole hours, no minutes. This assumption was wrong.

This caused issues with schedules as the timezone offset we are setting up our database connections were wrong because of this in some timezones.

Fixes #4821

…inutes

The current version of getMySQLTimezoneOffset() assumes that all timezones are whole hours, no minutes. This assumption was wrong.
@danny6167
Copy link
Member Author

danny6167 commented Jul 20, 2023

A little proof that the proposed change returns what we need it to

root@pterotest:/var/www/pterodactyl# php artisan tinker
Psy Shell v0.11.8 (PHP 8.1.21 — cli) by Justin Hileman
>>> $timezone = "Australia/Darwin"
=> "Australia/Darwin"

>>> Pterodactyl\Helpers\Time::getMySQLTimezoneOffset($timezone)
=> "+09:30"

@Zephira58
Copy link

Applied this patch to my Petro install as i was having issues with the backup system here's a before and after.
Ps: Thanks for letting me know about this on discord danny, your a life saver!

Without

without

With

With

matthewpi added a commit that referenced this pull request Aug 23, 2023
Previously the `getMySQLTimezoneOffset()` function would truncate the
seconds part of a time offset (returning `+9:00` instead of `+9:30`) for
example. This only affects timezones with offsets that contain minutes.

Closes #4821
Superseeds #4827

Co-authored-by: danny6167 <daniel@barteck.com.au>
@matthewpi
Copy link
Member

Superseded by 04d83ed

Future PRs need to go into 1.0-develop unless they are for v2.

@matthewpi matthewpi closed this Aug 23, 2023
@danny6167 danny6167 deleted the fix-4821 branch November 18, 2023 19:16
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.

Incorrect Job Execution in Schedules with UTC+X:30 Timezone/Multiple Backups when using schedules.
3 participants