-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
TSDBJNIConnector类
private static void handleTimeZone(String posixTimeZoneStr) {
if (posixTimeZoneStr.startsWith("UTC") || posixTimeZoneStr.startsWith("GMT")) {
if (posixTimeZoneStr.length() == 3) {
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("GMT")));
return;
}
String regex = "^(UTC|GMT)([+-])(\\d+)$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(posixTimeZoneStr);
if (matcher.matches()) {
String op = matcher.group(2);
String hourStr = matcher.group(3);
// 这里+ 为什么要变成-
if (op.equals("+")) {
op = "-";
} else {
op = "+";
}
int hour = Integer.parseInt(hourStr);
if (hour > 18) {
return;
}
String timezone = String.format("GMT%s%02d:00", op, hour);
// 这里为什么要设置默认时区,导致我jvm设置user.timezone都给覆盖了
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of(timezone)));
return;
}
}
if (posixTimeZoneStr.contains("/")) {
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of(posixTimeZoneStr)));
}
}Metadata
Metadata
Assignees
Labels
No labels