mirror of
https://github.com/etesync/android
synced 2025-05-14 12:58:49 +00:00
Merge pull request #473 from Springuin/master
Time zone guessing improved, fixes 'Assuming time zone Etc/GMT for Etc/G...
This commit is contained in:
commit
7d5ed0bd11
@ -349,14 +349,27 @@ public class Event extends Resource {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
String localTZ = Time.TIMEZONE_UTC;
|
String localTZ = Time.TIMEZONE_UTC;
|
||||||
|
boolean foundMatch = false;
|
||||||
String availableTZs[] = SimpleTimeZone.getAvailableIDs();
|
String availableTZs[] = SimpleTimeZone.getAvailableIDs();
|
||||||
for (String availableTZ : availableTZs)
|
|
||||||
|
// Try to find an exact match
|
||||||
|
for (String availableTZ : availableTZs) {
|
||||||
|
if (tzID.equals(availableTZ)) {
|
||||||
|
localTZ = availableTZ;
|
||||||
|
foundMatch = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundMatch) {
|
||||||
|
// Try to find something else that matches
|
||||||
|
for (String availableTZ : availableTZs) {
|
||||||
if (tzID.indexOf(availableTZ, 0) != -1) {
|
if (tzID.indexOf(availableTZ, 0) != -1) {
|
||||||
localTZ = availableTZ;
|
localTZ = availableTZ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Log.d(TAG, "Assuming time zone " + localTZ + " for " + tzID);
|
Log.d(TAG, "Assuming time zone " + localTZ + " for " + tzID);
|
||||||
date.setTimeZone(tzRegistry.getTimeZone(localTZ));
|
date.setTimeZone(tzRegistry.getTimeZone(localTZ));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user