Powernap is a small Python extension for accurate
sleeping. Python's time.sleep() function is
fairly inaccurate. It is definitely not accurate
enough for music, games, or graphics. It can sleep
too long or too short, and usually does. Using
Linux's real-time clock (RTC) allows for more
accurate timing. This extension wraps all the
messy RTC stuff and provides nap(), which performs
the same job as sleep(), but more accurately. Even
more usefully, it provides rnap(), which is a
padding nap. That is, if you call rnap(30), it
will nap for however many milliseconds are
required to make the time since the last nap 30
milliseconds. rtc_on() sets up the real-time
clock, and rtc_off() turns it off. It also
switches the scheduler to SCHED_FIFO.