1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-08 22:51:37 +02:00

Assume timezone UTC for BLE time protocol

BLE protocol only sends a UTC offset which combines the TZ with DST, if we take
a local timezone as a base and add a raw offset with DST included, DST might
be added again.

This is to fix problems with recorded data on Huami devices where we cannot know
in which timezone data was recorded - only the offset, where we do not know if a
part of it is DST.
This commit is contained in:
Andreas Shimokawa 2021-08-06 00:56:45 +02:00
parent 9222c6700e
commit e5caf78fb0

View File

@ -118,7 +118,9 @@ public class BLETypeConversions {
);
if (value.length > 7) {
TimeZone timeZone = TimeZone.getDefault();
/* when we get a timezone offset via BLE, we cannot know which timeszone this is (only its offset), so
set to UTC which does not use DST to prevent bugs when setting the raw offset below */
TimeZone timeZone = TimeZone.getTimeZone("UTC");
timeZone.setRawOffset(value[7] * 15 * 60 * 1000);
timestamp.setTimeZone(timeZone);
}