private function nextTimeout(): ?int
    {
        $time = \microtime(true);
        
        while (!$this->scheduler->isEmpty()) {
            list ($watcher, $scheduled) = $this->scheduler->top();
            
            if ($watcher->enabled && $watcher->scheduled === $scheduled) {
                return (int) \max(0, ($watcher->due - $time) * 1000000);
            }
        }
        
        return null;
    }