Freeze the clock. Every major test runner has fake timers now:
The alternative, which is better if you can afford the refactor, is to stop reaching for the global clock at all:
Now the test passes an explicit now and needs no framework magic. Injected time also makes the function easier to reason about — it becomes pure.