[Python-ideas] millisecond and microsecond times without floats
njs at pobox.com
Wed Jun 24 01:46:05 CEST 2015
On Tue, Jun 23, 2015 at 4:32 PM, Gregory P. Smith <greg at krypto.org> wrote:
> I still don't see how an elapsed() function taking two arbitrary integer
> arguments could work in a meaningful manner. Even if you assume they are
> the same units, the only assumption that can be made is that if the second
> int is lower than the first, at least one wraparound occurred.
Assuming you have an n-bit clock:
(1) if you have arbitrary storage and the ability to do some sort of
interrupt handling at least once per wraparound period, then you can
reliably measure any duration.
(2) if you don't have that, but can assume that at most one wraparound
has occurred, then you can reliably measure any duration up to 2**n
(3) if you can't even make that assumption, then you can't reliably
measure any duration whatsoever, so there's no point in even having
I guess micropython is targeting platforms that can't afford option
(1), but would like to at least take advantage of option (2)?
Nathaniel J. Smith -- http://vorpus.org
More information about the Python-ideas