More legible:

testpulse1=$(date +%s%N | cut -b1-13) && echo $testpulse1

testpulse2=$(date +%s%N | cut -b1-13) && echo $testpulse2

pulsegap=$(($testpulse2-$testpulse1)) && echo $pulsegap

Warmly yours.