Exact calculation of the amount of sleep