Using Millis for timing - strange behaviour during simulation