1

System time 12:05:00 string datetime = "12:15:00";

12:12:00 3 minutes ago MessageBox.Show ("3 minutes left");. How can i do it please give me a suggestion.

How can I update the Windows system clock time.windows.com I want to update the Windows time, but I know I can manually set the date time, but I do not know how to do it from the form

if you have a suggestion please share with me

Michał Turczyn
  • 32,028
  • 14
  • 47
  • 69
S.develop
  • 13
  • 4
  • It sounds like you're trying to programmatically alter the date/time on your Windows PC? Can you post some C# code from your .NET form showing what you've tried? BTW, `time.windows.com` is the host name of an NTP server provided by Microsoft; not the same thing as your computer's real time clock (Google `NTP` for more info). If Windows on your PC is configured to use NTP to synchronize its the PC clock, you'll need to disable that as a first step. Otherwise, any change you make to your PC clock will only last until Windows synchronizes with `time.windows.com` again. – Scott Smith Mar 25 '18 at 23:39
  • Also, the "3 minutes left" and "3 minutes before" in your question suggest that you may be implementing a countdown timer in your form? Are you really trying to adjust your PC's clock, or are you just wanting to display a timer of some kind? Some code would help clear up the confusion. – Scott Smith Mar 25 '18 at 23:44
  • Hi Scott, I want to do a neutron-like application I want to update the system clock when I open my projem time should not be wrong error is not accepted the system is a small-scale project together I have to link it to the example below Neutron 10 kb I want to update the system saaat on all conditions project link :https://www.raymond.cc/blog/auto-sync-pc-clock-on-windows-startup/ – S.develop Mar 28 '18 at 03:18

1 Answers1

0

As far as I can tell, you can't directly access the CMOS RTC clock under Windows via C#/.NET. In any case, from what I've read, doing so is likely to introduce other problems.

Instead, you might consider programmatically triggering Windows Internet Time to sync immediately, instead of having it wait up to a week for Windows to do it.

Scott Smith
  • 3,900
  • 2
  • 31
  • 63