mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Garmin: Improve computed timestamp parsing
timestamp16 must be applied against garmin epoch.
This commit is contained in:
parent
bdd698b7d3
commit
89046d0815
@ -165,8 +165,8 @@ public class RecordData {
|
|||||||
tsb.append(globalFITMessage.name());
|
tsb.append(globalFITMessage.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (computedTimestamp != null) {
|
if (getComputedTimestamp() != null) {
|
||||||
tsb.append(new Date(computedTimestamp * 1000L));
|
tsb.append(new Date(getComputedTimestamp() * 1000L));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FieldData fieldData : fieldDataList) {
|
for (FieldData fieldData : fieldDataList) {
|
||||||
|
@ -2,6 +2,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminTimeUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordData;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordData;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordDefinition;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordDefinition;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordHeader;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordHeader;
|
||||||
@ -77,7 +78,9 @@ public class FitMonitoring extends RecordData {
|
|||||||
final Integer timestamp16 = getTimestamp16();
|
final Integer timestamp16 = getTimestamp16();
|
||||||
final Long computedTimestamp = super.getComputedTimestamp();
|
final Long computedTimestamp = super.getComputedTimestamp();
|
||||||
if (timestamp16 != null && computedTimestamp != null) {
|
if (timestamp16 != null && computedTimestamp != null) {
|
||||||
return (computedTimestamp & ~0xFFFFL) | timestamp16;
|
return (long) GarminTimeUtils.garminTimestampToUnixTime(
|
||||||
|
(GarminTimeUtils.unixTimeToGarminTimestamp(computedTimestamp.intValue()) & ~0xFFFF) | (timestamp16 & 0xFFFF)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return computedTimestamp;
|
return computedTimestamp;
|
||||||
}
|
}
|
||||||
|
@ -45,4 +45,15 @@ public class FitStressLevel extends RecordData {
|
|||||||
public Long getStressLevelTime() {
|
public Long getStressLevelTime() {
|
||||||
return (Long) getFieldByNumber(1);
|
return (Long) getFieldByNumber(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// manual changes below
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getComputedTimestamp() {
|
||||||
|
final Long stressTime = getStressLevelTime();
|
||||||
|
if (stressTime != null) {
|
||||||
|
return stressTime;
|
||||||
|
}
|
||||||
|
return super.getComputedTimestamp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user