I have hit a wall.  The serial.print line corresponding to "Net time d: " continuously updates, even when the input to pin 4 is completely unplugged.  I don't know why this problem is occurring or how to fix it.