import { useEffect, useState } from 'react';

/** Monotonic wall clock for cooldown / effect countdown UI (low-frequency re-renders). */
export function useUiClock(intervalMs = 100): number {
  const [t, setT] = useState(() => Date.now());
  useEffect(() => {
    const id = window.setInterval(() => setT(Date.now()), intervalMs);
    return () => window.clearInterval(id);
  }, [intervalMs]);
  return t;
}
