4

Does anyone know how I would force the computer to update the time with the time server, you can do this manually doing: Right Click on time -> Adjust date/time -> Internet Time -> Change Settings -> and update now.

I want to write a program that incorpates that same functionality, but does it automaticly.

Any suggestions?

Darestium

Darestium
  • 643
  • 2
  • 11
  • 29
  • 3
    You do realize Windows already does this, right? It automagically synchronizes like once a week. – cHao Dec 26 '11 at 10:13
  • Check [NtpClient](http://stackoverflow.com/questions/1193955/how-to-query-an-ntp-server-from-c-sharp) – V4Vendetta Dec 26 '11 at 10:15
  • Though I dont know why you need it, We have something similar but we actually simulate a date on client using remoting/wcf which sync with server as our rest of communication is using Remoting/WCF. Changing time on client blindly may cause some other issues with other applications running on the client box. – Surjit Samra Dec 26 '11 at 10:41

1 Answers1

2

You can write directly in the windows registry from your program, the interested key is :

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters

Reference here .

To learn how to read, write into the windows registry from your C# applications, take a look at this example .

aleroot
  • 71,077
  • 30
  • 176
  • 213