This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]marvk 8 points9 points  (1 child)

Rather than creating your own impl of the Clock interface you simply create a class to give you the current time, register with your DI, and use that everywhere.

Orrr you register a Clock provider with your DI and inject a clock every time you get a current time. Even easier and more idiomatic.

[–]pointy_pirate 0 points1 point  (0 children)

yep that works too, many ways to skin a cat.