我可以依靠iOS设备时钟正确吗? [英] Can I Rely on the iOS Device Clock Being Correct?

查看:77
本文介绍了我可以依靠iOS设备时钟正确吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,它将通过我控制的服务器在用户之间同步数据。目前,我正在记录每个设备上的UTC更改时间,这有助于确定哪些数据是最新的 - 服务器上或设备上的数据。

I am working on an app that will sync data between users through a server that I control. Currently, I am recording the UTC time of changes on each device, which then helps determine which data is most recent - the data on the server or on the device.

可以我依靠iPhone和iPad的UTC时间准确吗?如果没有,我还能如何标记更新仍然可以让我检测来自不同用户的更新并检测可能的更新冲突?

Can I rely on the iPhone and iPad UTC time being accurate? If not, how else could I stamp updates that will still let me detect updates from various users and detect possible update collisions?

推荐答案

出于您的目的,最好使用像 http://en.wikipedia.org/wiki/这样的逻辑时钟。 Lamport_timestamps

For your purposes, it is best to use a logical clock like http://en.wikipedia.org/wiki/Lamport_timestamps

这篇关于我可以依靠iOS设备时钟正确吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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