bug report: [ #447945 ] time.time() is not non-decreasing

Tim Peters tim.one at home.com
Sat Aug 4 22:08:36 EDT 2001


[zooko at zooko.com]
> Okay, I think what is happening is that `time.time()' uses
> `gettimeofday()' which reads the hardware clock.  This means that
> in theory it can return anything at all, ...

Yes it can, and precision has nothing to do with accuracy anyway (i.e., just
because a thing saves enough bits to report microseconds doesn't it mean it
updates that often, and esp. not across platforms), so why are you still
trying to use it?  That is, in:

> ...
> but for my purposes in Mojo Nation I needed a guaranteed monotonically
> increasing time.

what does wall-clock time have to do with whatever it is you're after?

> ...
> The application which needs monotonically increasing timestamps
> is the `DoQ'[4] (the "do queue") -- a simple event scheduler that
> we use in Mojo Nation.

Simulators of many kinds just increment an integer to get a
guaranteed-unique (within a run) and strictly increasing "timestamp".  Does
wall-clock time specifically have something to do with your problem?





More information about the Python-list mailing list