@@ -617,8 +617,23 @@ DECLARE_FIELD(RECORD, rmv, UINT16) { } // 100 * l/min
617
617
DECLARE_FIELD (RECORD , ascent_rate , SINT32 ) { } // mm/s (negative is down)
618
618
619
619
// DEVICE_SETTINGS
620
- DECLARE_FIELD (DEVICE_SETTINGS , utc_offset , UINT32 ) { garmin -> dive .utc_offset = (SINT32 ) data ; } // wrong type in FIT
621
- DECLARE_FIELD (DEVICE_SETTINGS , time_offset , UINT32 ) { garmin -> dive .time_offset = (SINT32 ) data ; } // wrong type in FIT
620
+ DECLARE_FIELD (DEVICE_SETTINGS , utc_offset , UINT32 )
621
+ {
622
+ garmin -> dive .utc_offset = (SINT32 ) data ; // wrong type in FIT
623
+ }
624
+ DECLARE_FIELD (DEVICE_SETTINGS , time_offset , UINT32 )
625
+ {
626
+ /*
627
+ * Crazy FIT files have a zero time offset in DEVICE_SETTINGS,
628
+ * but then have a local_timestamp in ACTIVITY and/or in the
629
+ * TIME_CORRELATION messages.
630
+ *
631
+ * So I have no idea what this field means then.
632
+ */
633
+ if (!data )
634
+ return ;
635
+ garmin -> dive .time_offset = (SINT32 ) data ; // wrong type in FIT
636
+ }
622
637
623
638
// DEVICE_INFO
624
639
// collect the data and then use the record if it is for device_index 0
@@ -677,6 +692,19 @@ DECLARE_FIELD(SPORT, sub_sport, ENUM) {
677
692
DC_ASSIGN_FIELD (garmin -> cache , DIVEMODE , val );
678
693
}
679
694
695
+ /*
696
+ * What is the difference between 'system_timestamp' and the
697
+ * actual timestamp of the message itself? Who designs these
698
+ * crazy things? What is the meaning of it all? These are the
699
+ * kinds of unanswerable questions that keep me up at night.
700
+ */
701
+ DECLARE_FIELD (TIMESTAMP_CORRELATION , system_timestamp , UINT32 ) { }
702
+ DECLARE_FIELD (TIMESTAMP_CORRELATION , local_timestamp , UINT32 )
703
+ {
704
+ int time_offset = data - garmin -> record_data .timestamp ;
705
+ garmin -> dive .time_offset = time_offset ;
706
+ }
707
+
680
708
// DIVE_GAS - uses msg index
681
709
DECLARE_FIELD (DIVE_GAS , helium , UINT8 )
682
710
{
@@ -988,6 +1016,14 @@ DECLARE_MESG(RECORD) = {
988
1016
}
989
1017
};
990
1018
1019
+ DECLARE_MESG (TIMESTAMP_CORRELATION ) = {
1020
+ .maxfield = 6 ,
1021
+ .field = {
1022
+ SET_FIELD (TIMESTAMP_CORRELATION , 1 , system_timestamp , UINT32 ),
1023
+ SET_FIELD (TIMESTAMP_CORRELATION , 3 , local_timestamp , UINT32 ),
1024
+ }
1025
+ };
1026
+
991
1027
DECLARE_MESG (DIVE_GAS ) = {
992
1028
.maxfield = 4 ,
993
1029
.field = {
@@ -1181,6 +1217,8 @@ static const struct {
1181
1217
1182
1218
SET_MESG (147 , SENSOR_PROFILE ),
1183
1219
1220
+ SET_MESG (162 , TIMESTAMP_CORRELATION ),
1221
+
1184
1222
SET_MESG (206 , FIELD_DESCRIPTION ),
1185
1223
1186
1224
SET_MESG (216 , WTF_216 ),
0 commit comments