Overriding System Time for Testing

Hi! Is there a way to fix the system time?

This would be useful in order to compare against dynamically generated timestamps which are not predictable.

Hi Frank,

I guess you could use the Run command to execute an OS command to set the date and time to a specific value every time, but you will probably also need to disable any NTP settings in the OS or the time will get “corrected”.

remember “timestamps” are seconds since epoch so just changing the time is not enough, you need to change the date as well.

I also urge caution with this kind of approach:

  • If you are using a windows machine in a corporate environment this will break any domain trusts which may prevent you from logging onto the machine.
  • Many applications also validate the timestamp so if you set the date/time to a value that is too different to what the application server is expecting you may get weird issues or even kicked out of the server.

There is plenty to contemplate, hope this was helpful,

Dave.