I have an NTP server and I get the date as shown below:
DateTime NTPDateTime = GetServerTime();
but my problem is that I get the current time from the ntp server, but I canโt update it without reconnecting with the NTP server.
I tried to do this in a stream like (1000 ms interval)
string displayTime() {
this.lblServerTime.Text = NTPDateTime.ToLongTimeString();
}
It always shows the same DateTime as expected. How (01.10.2014 - 15:31:25)
But how can I update the DateTime so that it always gives me the current DateTime?
Example, if I use the following code, it gives me the current local time
string displayTime() {
this.lblServerTime.Text = DateTime.Now.ToLongTimeString();
}
But I need server time, not localtime. and my problem is that I canโt get it everysecond.
Is there a way to do this, without a new connection every second to the ntp server? I have over 500 client applications that require server time.