Problem with time.time() standing still

Bob Cowdery bob at bobcowdery.plus.com
Sat May 5 15:33:44 EDT 2012


Hi all,

I've been a long time user of Python and written many extensions but
this problem has me stumped.

I've written a straight forward extension that wraps a vendors SDK for a
video capture card. All works well except that in the Python thread on
which I call the extension, after certain calls that I believe are using
DirectShow,  time stands still. The thread returns fine as the extension
does its stuff in its own threads. In all other respects the Python
thread seems unaffected but calls to time.time() always return the same
time which is usually several seconds in the past or future and always
has no fractional part. If I leave it long enough time will suddently
jump forward after a few minutes, then again after a few minutes more.

I've never encountered this behaviour before and can't understand what
on earth is going on. If I call the 'C' time() function just the other
side of my call to the extension the time is ticking along fine. It's
just the one Python thread that is affected. If I call from the main
thread then the main thread is affected. The calling program I've used
to test this is just a few lines long.

I believe the time function is a thin wrapper over the 'C' runtime so
its very odd that time only stands still on the Python side but not on
the 'C' side. As time is built in I've not looked at the code as its not
in the distribution. Don't know if it would help to do that.

This also can affect the time.sleep() function making it return
immediately but that only seems to happen in my full application.

Any ideas would be very greatly received.

Bob



More information about the Python-list mailing list