从互联网获取实际时间? [英] Get actual time from internet ?

查看:75
本文介绍了从互联网获取实际时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果更改设备时间,如何以编程方式获取当前(实际)时间或网络运营商的时间

How to get 'current(actual) time' or 'network operator's time' programmatically if device time is changed ?

I' m尝试通过 LocationManager类的'getLastKnownLocation'方法获取当前时间。但这给出了最后的定位时间,但我需要当前时间。

I'm trying to get current time through 'getLastKnownLocation' method of 'LocationManager' class. But it gives last location time, but I need current time.

有人可以告诉我有关从互联网获取实际时间的正确方法的提示吗?

Can anyone tell me a clue about the correct way to get actual time from internet ?


  • 如果可能的话,不使用任何外部库。

预先感谢。

推荐答案

您可以使用地名 http://www.geonames.org/login为此将需要纬度和经度

You can use a rest full api provided by geo names http://www.geonames.org/login it will require lat and long for this purpose for example

http://api.geonames.org/timezoneJSON?lat=51.5034070&lng=-0.1275920&username=您的用户名

这篇关于从互联网获取实际时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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