I would like my Python2 daemon to wake up and do something exactly on the second.
Is there a better way to get the decmal part of a floating point number for a sleep time other then:
now = time.time() #get the current time in a floating point format
left_part = long(now) #isolate out the integer part
right_part = now - left_part #now get the decimal part
time.sleep(1 - right_part) #and sleep for the remaining portion of this second.
The sleep time will be variable depending on how much work was done in this second.
Is there a "Sleep till" function I don't know about? or, is there a better way to handle this?
I would like my daemon to be as efficient as possible so as not to monopolize too much CPU from other processes.
Thanks. Mark.