Your point about hard real-time systems is very good.
Time::Clock uses Time::HiRes. It doesn't really buy anything. Especially since it doesn't offer a sleep function.
Time::HiRes also offers a nanosecond sleep function.
If you have access to a high-precision timer, you can use clock_nanosleep to control your timing based on the high precision timer.
It's also worth checking the return value of your sleep-type calls. They tell what the actual sleep time was. That way, if your sleep was interrupted by a signal, or if your sleep ran long for some reason, you will know, and can take appropriate action.
|