Is there some kind of timer function that returns the amount of time passed?
Just adding a few notes to the perfectly valid answers you already got:

On your typical AVR-based Arduino, micros() has a resolution of
4&nbsp;µs and millis() is updated every 1024&nbsp;µs. This last point
implies that millis() increments most times by 1&nbsp;ms, but
occasionally by 2&nbsp;ms. Keep this in mind if time resolution is an
issue.

Both millis() and micros() return 32-bit unsigned numbers. This
implies that millis() overflows (it rolls-over to zero) roughly every
49.7&nbsp;days and micros() every 71.6&nbsp;min. This limits the
maximum interval length you can measure with each of those functions. It
does not limit the maximum run time of your program, since
subtracting two timestamps does work fine across a rollover
event.