Convert timestamp 16 to date

Hi everyone, 

I am doing a project were I will need to combine heart rate data with an external dataset of other medical factors and I need to get the exact datetime of the dataset. In the developer page it says that the timestamp_16 column corresponds to date since 1970, however when I get the data I get a few thousand seconds, corresponding to hours not decades. How can I get the correct date and time for each heart-rate measurement? 

  • The timestamp_16 field is not a date_time, rather it is a uint16. The 16 bit values are used to keep the size of the file small, which is important for files that may contain 24 hours of information. The timestamp_16 values are the value of the previous timestamp field with the upper two bytes masked off plus any time change that occurred between the two messages.

    What you will see in a file with these timestamp_16 fields is a message with a timestamp field, a full date_time, followed by messages with a timestamp_16 field. A common example is for monitoring files with monitoring data, as the files may contain data for an entire day.

    Displaying the values as hex makes is easier to see:

    Definition,0,monitoring,timestamp,1,
    Data,0,monitoring,timestamp,"0x3C75A6D4",s
    Definition,1,monitoring,timestamp_16,1,,heart_rate,1
    Data,1,monitoring,timestamp_16,"0xA710",s,heart_rate,"64",bpm

    If the last seen timestamp is 0x3C75A6D4, masking the upper two bytes results in a value of  0x0000A6D4. Compare that to the timestamp_16 value in the next message 0xA710 and you get...
    0xA710 - 0xA6D4 = 0x3C = 60 seconds
  • Thank you for your reply! It was very helpful!