Add support for calculating how many ticks to sleep