Port register not working
According to anything I could find, the Echo output is normally low and then goes high for a duration equal to the range. Your initial while condition is inverted, and you need to check for both edges.

unsigned long up, down;

// trigger pulse
while (!(PINB &amp; _BV(PB5)))
  ; // wait for leading edge
up = millis();
while (PINB &amp; _BV(PB5))
  ; // wait for trailing edge
down = millis();
Serial.println(down - up);