Help with trouble shooting

This should be "unsigned long"
(Though I suspect a number that large would indicate an out-of-range condition for the sensor)

pingtime=pingtime;

I don't know what that's for.