Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

timestamp_16 in fit files

Rank

Total Posts: 1

Joined 2015-12-22

PM

Hi,

I am converting fit files from my Garmin FR235, specifically from the monitor directory. Those files contain heart_rate measurements that I want to look at.

Those records however use a "timestamp_16" that I don't know how to convert correctly and consistently. So far I have added those to the normal timestamp, divided by 86400 and then added date(1989;12;31) in excel to get something readable. Sometimes I have to add or substract some hours for the time to make sense, but it seems to be a different value in every file, just kind of trial and error. I am in GMT+1.

However it seems I get different time of day values when doing this in different files, like not the time I would expect. Also sometimes the first records have a timestamp with 5 digits, and suddenly they "start over" with a 3 digit timestamp. I would expect this may happen ad midnight, though I even find this happening in files that have been created after midnight.

Please see the attached example. In lines 31/32 you see this "transistion" where I had to change the forumla so that the time would still make sense.

Isn't there a forumla, that works for all records equally?

Thanks,
Philippe


     

File Attachments

Rank

Total Posts: 20

Joined 2015-05-11

PM

Hi Philippe,

It looks like we do not explain the usage of timestamp_16 in our documentation. We will look into adding an explanation for this in the future.

timestamp_16 is a 16 bit version of the timestamp field (which is 32 bit) that represents the lower 16 bits of the timestamp. This field is meant to be used in combination with an earlier timestamp field that is used as a reference for the upper 16 bits.

The proper way to deal with this field is shown in MonitoringReader.java in the SDK and summarized as follows:

mesgTimestamp += ( timestamp_16 - ( mesgTimestamp 0xFFFF ) ) & 0xFFFF


Where the mesgTimestamp is the previous 32 bit timestamp (the "timestamp" field). This essentially swaps the lower 16 bits of the timestamp field with the timestamp_16 field, and deals with any rollovers that may occur.

     
Rank

Total Posts: 1

Joined 2017-02-23

PM

This is exactly the same issue as I have.

Did either of you ever come up with an Excel Macro or formula that converts the timestamp_16 field into a consistent datetime value in Excel?