Time Synchronizations in Windows
Recently one of my components that I was developing was DateTime driven and hence I had to change system time to see its behavior for different periods. The problem is that, you need to be very careful with changed system times, particularly when you checkin the file to SourceSafe, SendMails since a wrong time means total chaos for these systems.
For these, I choose to have a simple batch file to syncrhonize time with the SourceSafe database itself. It just goes like this:
net time \\mysourcesafeserver /set /y
net time \\mysourcesafeserver queries the time on the server
/set sets the time on the localhost to the time on the server (This will wait for a prompt of confirmation from the user, which can be avoided by appending a /y to the command)
But I have a question. Perhaps if some sysadmin drops by this post, he can put a comment and solve this so that it will be useful to other readers.
- What happens if the logged on user does not have privileges to set time? He is getting Access is denied.
- With Windows XP (Time Synchryonization) itself, will the problem in (1) get solved?
- To query net time \\mysourcesafeserver one must be logged on to \\mysourcesafeserver previously either my remembered network connection or previous manual logon? Is there any other solution for this?
But I hope the above batch file would be useful to many developers playing with and developing DateTime driven components.
/* Migrated from Daffodilnet Express — posted on October 15, 2004 */