1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Pebble: Fix wrong timestamps with Morpheuz running on Firmware >=3

Fixes #689
This commit is contained in:
Andreas Shimokawa 2017-05-13 22:18:56 +02:00
parent a1690700f4
commit b31a6a5db9

View File

@ -28,7 +28,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import java.util.SimpleTimeZone; import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
@ -158,9 +157,11 @@ class AppMessageHandlerMorpheuz extends AppMessageHandler {
int version = (int) pair.second; int version = (int) pair.second;
LOG.info("got version: " + ((float) version / 10.0f)); LOG.info("got version: " + ((float) version / 10.0f));
ctrl_message |= CTRL_VERSION_DONE; ctrl_message |= CTRL_VERSION_DONE;
} else if (pair.first.equals(keyBase)) {// fix timestamp } else if (pair.first.equals(keyBase)) {
TimeZone tz = SimpleTimeZone.getDefault(); recording_base_timestamp = (int) pair.second;
recording_base_timestamp = (int) pair.second - (tz.getOffset(System.currentTimeMillis())) / 1000; if (mPebbleProtocol.mFwMajor < 3) {
recording_base_timestamp -= SimpleTimeZone.getDefault().getOffset(recording_base_timestamp * 1000L) / 1000;
}
LOG.info("got base: " + recording_base_timestamp); LOG.info("got base: " + recording_base_timestamp);
ctrl_message |= CTRL_SET_LAST_SENT | CTRL_DO_NEXT; ctrl_message |= CTRL_SET_LAST_SENT | CTRL_DO_NEXT;
} else if (pair.first.equals(keyAutoReset)) { } else if (pair.first.equals(keyAutoReset)) {