Reputation: 14383
Does anybody know of a Windows tool to report fake dates/times to a process?
Apparently there are Linux programs that can be used to test how the software will react in the future / in a different timezone or to trigger scheduled tasks without actually modifying the system clock. Are there such programs for Windows?
Upvotes: 22
Views: 26381
Reputation: 71111
Starting about 2 years ago, I always abstract the call to DateTime.Now (C#) through a Utility class. This way I can always fake the date/time if I want to, or just pass it directly through to DateTime.Now.
Sounds similiar to what BillH suggested.
public class MyUtil
{
public static DateTime GetDateTime()
{
return DateTime.Now.AddHours(5);
//return DateTime.Now;
}
}
Upvotes: 1
Reputation: 6138
Wrapper your calls to the 'getCurrentDateTime()' system calls so you can introduce offsets or multipliers into the times your code reads during testing?
Upvotes: 0