Revised sleep/wakeup logic in TimeScheduler