i would like to have python code, and will eventually write it if no one else has, to sleep until a specified time period, such as a minute. i have written this in C before. the period is defined in seconds repeating from the epoch used by the platform time source(). so if the period value is given as 60, it will sleep until the next one minute period. if the period value is given as 3600, it will sleep until the next one hour period. so if the current time is 7:59:40, both examples will sleep for 20 seconds until 8:00:00. if the current time is 7:26:30 the first example (60 second period) will sleep for 30 seconds until 7:27:00 and the second example (3600 second period) will sleep for 2010 seconds until 8:00:00.
the code should be divided up as a command and importable function that does the same thing. additionally the function should be divided up to have another function that figures out how many seconds to sleep.
an additional feature is offsets. an offset can also be specified that specifies how many seconds into the period to sleep to. if the current time is 7:59:40 and the specified period is 60 and the specified offset is 45 then the next 45 second offset of a 60 second period is 7:59:45 (not 8:00:45). so an offset could result in a shorter sleep time (if the current time has not yet reached the offset in the current period). an offset of 0 is the same as if offsets are not implemented.
yet another additional feature is minimum time. this means the time to sleep to is a later period (and offset into that period) so that the sleep time is not less than the minimum. a minimum of 0 is the same as if minimums are not implemented.
one of the benefits of this way of sleeping is being able to repeat things without accumulating timing errors. as i mentioned earlier i have already implemented this in C. that edition was implemented strictly as a command. you can see that source code here: nsleep.c
the code should be divided up as a command and importable function that does the same thing. additionally the function should be divided up to have another function that figures out how many seconds to sleep.
an additional feature is offsets. an offset can also be specified that specifies how many seconds into the period to sleep to. if the current time is 7:59:40 and the specified period is 60 and the specified offset is 45 then the next 45 second offset of a 60 second period is 7:59:45 (not 8:00:45). so an offset could result in a shorter sleep time (if the current time has not yet reached the offset in the current period). an offset of 0 is the same as if offsets are not implemented.
yet another additional feature is minimum time. this means the time to sleep to is a later period (and offset into that period) so that the sleep time is not less than the minimum. a minimum of 0 is the same as if minimums are not implemented.
one of the benefits of this way of sleeping is being able to repeat things without accumulating timing errors. as i mentioned earlier i have already implemented this in C. that edition was implemented strictly as a command. you can see that source code here: nsleep.c
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.