如何在Windows Phone 8的c#中获得当前的精确时间? [英] How to get current exact utc time in c# for windows phone 8?

查看:73
本文介绍了如何在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.

希望它有所帮助


这篇关于如何在Windows Phone 8的c#中获得当前的精确时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆