I'd argue that, in this context, sleep() itself is buggy
Most (all?) microcontrollers have a wide range of low-power modes that disable more and more features of the chip to save power.
So if you only need it to do something say once every minute, you can usually save a lot of battery life by using the low-power modes.