function getDuration() {

  // Calculate the duration from the last inserted record
  var duration = di.now().toFixed() - lastRecordTimestamp;

  // Update the lastRecordTimestamp
  lastRecordTimestamp = di.now().toFixed();

  return duration;

}
Calculate the duration from the last inserted record in ms,
and update lastRecordTimestamp

@return {Number}