是否有可能从iphone GPS获取原子钟时间戳? [英] Is it possible to get the atomic clock timestamp from the iphone GPS?
问题描述
我正在寻找一种可靠的方式来获得时间。它不能被篡改,它需要脱机工作。所以没有上网时间,没有设置用户时间,没有自上次重启后的BSD正常运行时间。我想知道,因为GPS使用原子钟工作,我是否可以访问这些信息。
谢谢 这可以获得GPS时间: 虽然它似乎不是防篡改的。 我在飞行模式(iOS 6.1)上的iPhone 4上试过这段代码,即便如此,它也给了一些时间。但不幸的是,这一次似乎随着系统时钟而改变。呃。 我发现有趣的事情(仍然处于飞行模式)是,如果您篡改系统时钟(转向 2010年的一次讨论。倒数第二个评论的作者在一个放射性庇护所中试了一下:所以很明显,手机并没有从任何外部来源获得原始的时间。 发现更多帖子(此处,这里和这里)关于另一种时间测量:系统内核启动时间。它通过这样的调用来访问: I'm looking for a reliable way to get the time. It can't be tampered with and it needs to work offline. So no internet time , no user time setup in settings and no BSD uptime time since last reboot. I was wondering since GPS works using atomic clock, whether I could access that information. Thank you This works to get the GPS time: It doesn't seem to be tamper-proof though. I tried this code on an iPhone 4 in airplane mode (iOS 6.1), and even then it gives a time all right. But unfortunately this time seems to change with the system clock. Ugh. Funny thing that I found (still in airplane mode) is that if you tamper with the system clock (after turning to P.S. A discussion of this from 2010. The author of the penultimate comment tried this in a fallout shelter: so it's clear the phone is not getting the pristine time from any external source. Found a few more posts (here, here and here) about another kind of time measure: system kernel boot time. It's accessed through a call something like this: 这篇关于是否有可能从iphone GPS获取原子钟时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
#import< CoreLocation / CoreLocation.h> ;
CLLocation * gps = [[CLLocation alloc]
initWithLatitude:(CLLocationDegrees)0.0
longitude:(CLLocationDegrees)0.0];
NSDate * now = gps.timestamp;
关闭
Time& Date's
自动设置
),然后将自动设置
返回到在
上,机器会顺利恢复真实(原始)时间。即使在关闭手机的电源之后,这种方式仍然有效因此,看起来 就像设备内部维护的防篡改时间。但如何访问这个?
附录,2013年7月
sysctlbyname(kern.boottime,& boottime,& size,NULL,0);
。不幸的是,它也随着用户调整的数据和时间而改变,即使没有重新启动。另一个函数 gettimeofday()
同样依赖于用户定义的时间。#import <CoreLocation/CoreLocation.h>
CLLocation* gps = [[CLLocation alloc]
initWithLatitude:(CLLocationDegrees) 0.0
longitude:(CLLocationDegrees) 0.0];
NSDate* now = gps.timestamp;
off
Time & Date's Set Automatically
), and then turn Set Automatically
back to on
, the machine restores the real (original) time without a hitch. this works even after cycling the phone's power. So it seems that there is something like a tamper-proof time the device maintains internally. But how to access this?Addendum, July 2013
sysctlbyname("kern.boottime", &boottime, &size, NULL, 0);
. Unfortunately it too changes with the user-adjusted data and time, even without reboot. Another function gettimeofday()
is similarly dependent on user-defined time.