1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-02-22 15:31:37 +01:00

Fossil Hybrid HR: Fix 2nd TZ widget offset

The 2nd TimeZone watchface widget was configured with an offset that
didn't take DST into account. This change makes it use the correct
offset.

Fixes #2761
This commit is contained in:
Arjan Schrijver 2022-07-14 09:48:12 +02:00
parent c77521f975
commit 6d16625112

View File

@ -30,6 +30,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.TimeZone;
@ -98,7 +99,7 @@ public class HybridHRWatchfaceFactory {
JSONObject data = new JSONObject();
TimeZone tz = TimeZone.getTimeZone(widgetDesc.getExtraConfigString("tzName", null));
String tzShortName = widgetDesc.getExtraConfigString("tzName", null).replaceAll(".*/", "");
int tzOffsetMins = tz.getRawOffset() / 1000 / 60;
int tzOffsetMins = tz.getOffset(Calendar.getInstance().getTimeInMillis()) / 1000 / 60;
data.put("tzName", widgetDesc.getExtraConfigString("tzName", null));
data.put("loc", tzShortName);
data.put("utc", tzOffsetMins);