Is there a way, even a very sneaky way, to change the time that a DateTime.UtcNow returns for a process or thread?
The SetSystemTime()
win32 API call will change the time on the entire system. I've used this before but I would like a method that is less evil to other processes running on the system. Messing with the time is bad kungfoo on automated build servers.
C# seems to lack the language features required to override the default behavior.
Perhaps the method that .Net uses to obtain the current time could be proxied in some way?