Python Forum
my ideas for a new sleep command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my ideas for a new sleep command
#1
i hate when a sleep loop gradually creeps off time. doing sleep 60 doesn't synchronize to the minute, for example. my plan is to write a new sleep command in python that can.

used like the old sleep command it will work the same old way. with a 2nd argument added, it will synchronize to the period specified by the 2nd number, with the 1st number, which must not be larger than the 2nd, being an offset into the period of the 2nd, so "sleep 15 60" would sleep until the next cycle of 15 seconds past a minute. so if the current time is 9:13:04.000 it will sleep for 9 seconds. that way it can be used in a loop intended to run a command every minute at 15 seconds after the minute.

another thing i want it to do is accept times to sleep to. so "sleep 10:05" will sleep until the next "10:05", however long that happens to be. whether it works in 12 hour mode or 24 hour mode might need an environment variable setting, an option, or an obvious time.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
snooze
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Open-source codes and concept ideas. sourceduty 0 751 Aug-11-2023, 02:11 AM
Last Post: sourceduty
  sleep to half past the hour Skaperen 11 3,858 Oct-29-2020, 06:41 AM
Last Post: Skaperen
  savin ideas, keeping notes Skaperen 15 6,838 Mar-31-2018, 10:26 PM
Last Post: Almenon
  want command program: sleep to a specific time Skaperen 3 3,532 Jul-11-2017, 01:33 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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