Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Strange hack in TimeUtils.changeTimezone (no replies)

$
0
0
I have a mysql server which I would like to connect to from two locations in different timezones. For this I tried to use useTimezone=true & serverTimezone=GMT parameters for the connection but I stumbled upon a very strange hack in changeTimezone.

After computing the offsetDifference the code does what seems like a hack:

if (rollForward || (conn.isServerTzUTC() && !conn.isClientTzUTC())) {
toTime += offsetDiff;
} else {
toTime -= offsetDiff;
}

where rollForward is false

So if the time zone of the server or of the client is UTC then the difference is added otherwise is substracted ???

So if I am in GMT+2 the time set on the server will be GMT + 4

But if I set serverTimezone=CET (i.e. GMT+1), then the time is set correctly to GMT + 1

What is the purpose of this hack and what would be the workaround?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>