1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 00:46:39 +02:00

Force the MySQL module to use UTC for connections.

This prevents conversion issues when the MySQL server is in a
different timezone to the services server.
This commit is contained in:
Sadie Powell
2025-03-06 20:35:35 +00:00
parent e099180d8f
commit 161841925d
+4
View File
@@ -631,6 +631,10 @@ void MySQLService::Connect()
if (!connect)
throw SQL::Exception("Unable to connect to MySQL service " + this->name + ": " + mysql_error(this->sql));
// We force UTC so that FromUnixtime works as expected.
SQL::Query tzquery("SET time_zone = '+00:00'");
RunQuery(tzquery);
if (this->socket.empty())
Log(LOG_DEBUG) << "Successfully connected to MySQL service " << this->name << " at " << this->server << ":" << this->port;
else