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
#1
Hello,

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:
Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Date Time Series Help...Please spra8560 2 314 Feb-01-2024, 01:38 PM
Last Post: spra8560
  Python date format changes to date & time 1418 4 518 Jan-20-2024, 04:45 AM
Last Post: 1418
  time difference bettwenn logs enkliy 14 877 Nov-21-2023, 04:51 PM
Last Post: rob101
Question Need Help with Vehicle Routing Problem with Time Windows (VRPTW) in Python kasper321421312 1 506 Nov-10-2023, 08:19 PM
Last Post: snippsat
  How do I stream and record at the same time with arducam? traderjoe 0 430 Oct-23-2023, 12:01 AM
Last Post: traderjoe
  i tried to install python for the first time today and pretty certain im being remote brianlj 2 507 Oct-03-2023, 11:15 AM
Last Post: snippsat
  [Python 2.7] Why can't I press [ESC] a fourth time? Ashwood 3 621 Aug-27-2023, 02:01 PM
Last Post: deanhystad
  Hard time trying to figure out the difference between two strings carecavoador 2 647 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  return next item each time a function is executed User3000 19 2,177 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  Downloading time zone aware files, getting wrong files(by date))s tester_V 9 961 Jul-23-2023, 08:32 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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