Problem with time.time() standing still

Chris Angelico rosuav at gmail.com
Sun May 6 04:24:41 EDT 2012


On Sun, May 6, 2012 at 6:18 PM, Bob Cowdery <bob at bobcowdery.plus.com> wrote:
> On 05/05/2012 23:05, Cameron Simpson wrote:
>> Thought #1: you are calling time.time() and haven't unfortunately
>> renamed it? (I doubt this scenario, though the lack of fractional part
>> is interesting.)
> Not sure what you mean by renamed it. I also tried datetime and that had
> the same behaviour.

In Python, names are nothing special, so you could do something like:

time.time = lambda: 142857

which means that time.time() will forever return that constant.

Take a snapshot of time.time early in your code somewhere, and try
using that instead, just in case. It's a long shot but might save you
some insanity!

ChrisA



More information about the Python-list mailing list