Monkey C - How to use Toybox.Sensor.HeartRateData

Hi! :)
I want to use the HeartRateData from my watch to get beat-to-beat interval, but I don't know what I should do with the data I get, and I can't find any documentation about it.

I got following data (for example):

HeartRateData: [500, 500, 517, 517]
HeartRateData: [500, 500, 517, 512]
HeartRateData: [500, 500, 514, 513]
HeartRateData: [500, 500, 512, 517]


What is the formular (or whatever) to get the beat-to-beat interval with these values?