Check out Clock Pattern by JR. Here is an excerpt:
Here is an old pattern I used to use in C# whenever I wanted to freeze time in a test, and then verify that something happened after.
You define a Clock object where you can freeze and set the time. Then whenever you want a time in your system or in tests you simply ask it for it’s time.
The full article is available here.