I have a method to request the hour from a ntp server. but I want the hour in milliseconds.
How can I do that?
I have this code:
void _ntpClient_TimeReceived(object sender, NtpClient.TimeReceivedEventArgs e)
{
this.Dispatcher.BeginInvoke(() =>
{
txtCurrentTime.Text = e.CurrentTime.ToLongTimeString();
long time_milli = e.CurrentTime.
txtSystemTime.Text = DateTime.Now.ToUniversalTime().ToLongTimeString();
});
}
in the variable time_milli I want the hour in milliseconds.. or seconds..
e.CurrentTime.Ticks return total ticks count (100-nanoseconds intervals), so you could convert it to milliseconds: e.CurrentTime.Ticks / 10000