Program uses 32 bit counter to achieve time with 400us resolution. Time in ms is stored in variable Time. When Timer overflows it is reseted.