如何在Windows Phone 8的c#中获得当前的精确时间?
我知道如何获得当前的时间..
I know how to get current utc time..
通过使用DateTime.UtcNow,我们将根据手机时间获得utc时间,但我想要全球时间。
By using DateTime.UtcNow we will get utc time based on our phone time but i want global time.
如果我的手机时间错误,它只会给出错误的时间。
If time is wrong in my mobile it will give wrong time only.
所以我想要正确的时间。
so i want correct time.
如何获得?
任何人都可以帮助我吗?
Can anyone help me?
获得确切时间的唯一方法是实现NTP客户端(NTP代表网络时间协议)。
The only way to get the exact hour would be to implement an NTP client (NTP stands for Network Time Protocol).
您必须发送请求通过Internet到时间服务器并处理响应。您可以查看
此链接 其中显示了如何实施这在Windows应用程序中并修改它以在WP8上工作。
You have to send a request to a Time Server over the Internet and handle the response. You can have a look to this link which shows how to implement this in a Windows Application and modify it to work on WP8.
希望它有所帮助