I don't understand this bug

"I want to calculate the duration of a loop"

I wouldn’t be surprised if your loop() runs in tens of microseconds.

Use Nick's profile timer:

See ZIP file: http://www.gammon.com.au/Arduino/ProfileTimer.zip