Calculate idle timer correctly. Fix clock allocation for windows