Python Forum
Time.sleep: stop appending item to the list if time is early
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time.sleep: stop appending item to the list if time is early

I have a timing problem. I want to stop appending item to the list, if time is early.
Here is my code lines:
self.tq is the arriving item time
self.lastt is the arrived item time
dataqueue is the list that I am put and send information after item is arrived
The condition is that: if self.otherport.lastt>self.lastt-self.delaytime: I can add the information to dataqueue
And if this condition is not valid, I want to stop to add information to dataqueue unless self.otherport.lastt>self.lastt-self.delaytime. How can I do that? I know in python we have time.sleep funtion but I could not stop to add info to the list
if self.tq <= self.lastt : 
            self.tq, self.arrivingqubit = next(self.inqubits)  
            print("we are here :)1")
         if len(self.dataqueue)==0:
            if self.otherport.lastt>self.lastt-self.delaytime:
               self.dataqueue.append((self.otherport.lastt+self.delaytime,self.fakequbit)) #here we have endless loop
               print("we are here :)2")
            #else: raise RuntimeError("Otherport is too old :(")
            else: #here I need to stop to adding item to list untill self.lastt>self.lastt-self.delaytime:

Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing time module Led_Zeppelin 2 146 Aug-31-2021, 02:16 PM
Last Post: Led_Zeppelin
  Done in no time? Mark17 2 394 Aug-20-2021, 03:34 PM
Last Post: deanhystad
  count item in list korenron 8 555 Aug-18-2021, 06:40 AM
Last Post: naughtyCat
  Converting 'Time' to AM/PM tester_V 18 3,356 Jul-30-2021, 09:07 PM
Last Post: tester_V
  How to print results of asyncio websockets at the same time? codingmonster 0 440 Jun-04-2021, 01:48 PM
Last Post: codingmonster
  Check last time file was accessed Pavel_47 4 640 Jun-01-2021, 05:47 PM
Last Post: Yoriz
Question Yielding ahead of time Daring_T 5 611 Jun-01-2021, 02:43 AM
Last Post: Daring_T
  Making certain texts stop at a certain time Arikiu 6 544 May-20-2021, 06:51 PM
Last Post: Arikiu
  Why recursive function consumes more of processing time than loops? M83Linux 9 1,175 May-20-2021, 01:52 PM
Last Post: DeaD_EyE
  Schedule a task and render/ use the result of the task in any given time klllmmm 2 492 May-04-2021, 10:17 AM
Last Post: klllmmm

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020