pulseIn(), photogate, time measurement

Wherever your Arduino installation lives, look in ../hardware/arduino/core/arduino/wiring_pulse.c