Bugs item #1607041, was opened at 2006-12-01 13:45
Message generated for change (Comment added) made by kuran
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1607041&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: BC (hashstat)
Assigned to: Nobody/Anonymous (nobody)
Summary: Condition.wait timeout fails when system clock changes

Initial Comment:
If the system clock is adjusted after Condition.wait is called with a timeout, 
the timeout does not expire as expected.  This appears to be due to the 
threading.Condition class using the system clock to calculate the timeout 
expiration without taking system clock changes into account.  Let me illustrate 
this with an example:


   import threading

   c = threading.Condition()
   c.acquire()
   try:
      ...
      c.wait(3600.0)
      ...
   finally:
      c.release()


Let's say the above snippet is executed at 08:00.  Assuming the condition is 
never notified, the timeout should expire somewhere close to 09:00.  At 08:30 
someone notices that the clock is an hour fast and sets it back to 07:30.  The 
timeout still expire around 09:00 causing a wait of 2 hours instead of the 
requested 1 hour.

Now let's say instead that the clock was moved ahead to 09:30 at 08:30.  The 
timeout would expire immediately after only a 30 minute wait.

----------------------------------------------------------------------

Comment By: Jp Calderone (kuran)
Date: 2006-12-01 16:06

Message:
Logged In: YES 
user_id=366566
Originator: NO

Why should it work that way?

c.wait(3600) doesn't say "wait until 0900", it says "wait 60 minutes".

If you want c.waitUntil(9 oclock), maybe that would be a good API
addition, but it definitely should be a separate method.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1607041&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to