millis() function

see - millis() - Arduino Reference -

It has a small cousin - http://arduino.cc/en/Reference/Micros -

and it is part of the most famous Arduino tutorial - http://arduino.cc/en/Tutorial/BlinkWithoutDelay -

Note the return value is an unsigned long, and one should take care when comparing millis() often you should use >= or <= to prevent missing "ticks" that can happen ewhen using == . Finally, allways use substractions like in the blinkWithoutDelay to be overflow proof.