cherry pick from master: improvement: now call millis() one time over an...

... update 40c7c1e89a9d98175d0ace74450700d7c844f361