Arduino compatible millisecond tracking

Updated how Energia tracks milliseconds to make output of millis() and
micros() identical with Arduino. This will fix issues with millis()
roll-over after 11 hours and not using the full 32bit available. The
millisecond timer now rolls over after approx. 50 days and basic
comparison like if(now - start > period) now works safely.

Implementation is mostly a direct port from latest Arduino version of
wiring.c. Compilation size is identical or only a few bytes bigger.