推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
maiganne
V2EX  ›  Python

求助:怎么做到客户端与服务器时间同步?

  •  
  •   maiganne · May 22, 2017 · 5564 views
    This topic created in 3459 days ago, the information mentioned may be changed or developed.

    比如说我要让自己的电脑时间与 V2EX 的服务器时间同步,如何做到呢?

    11 replies  •  2017-05-22 19:46:26 +08:00
    Hyeongo
    Hyeongo
    May 22, 2017 via iPhone
    1
    都与标准时间同步
    maiganne
    maiganne
    OP
    May 22, 2017
    2
    @Hyeongo 嗯,有些场景需要用到与目标网站的时间同步
    mengzhuo
    mengzhuo
    May 22, 2017
    3
    参考 ntp,注意:不能用 tcp,流控的时候就错了
    mengzhuo
    mengzhuo
    May 22, 2017❤️4
    4
    = =|| 按错键先发了
    ----------------------
    精度是多少?
    1. 分钟级、秒级直接 API 返回就好
    2. 毫秒级需要参考 ntp 的同步算法,还要注意以下问题
    2.1. 不能用 tcp,流控的时候就错了
    2.2. 需要 Marzullo 算法排除错误节点、跳变节点
    2.3. 必须考虑 CPU、晶振体速率的影响(同步间隔时间越长、偏移量越大)
    2.4. 需要使用状态机对内核(假设你的客户端是 unix 系)进行 pps 微调
    3. ns 级的话,你应该不会在这里问了
    maiganne
    maiganne
    OP
    May 22, 2017
    5
    @mengzhuo 谢了,哥们
    misaka19000
    misaka19000
    May 22, 2017
    6
    @mengzhuo #4 虽然看不懂,但是感觉好厉害的样(๑•ᴗ•๑)
    onion83
    onion83
    May 22, 2017
    7
    送三枚域名巨牛 x 的域名,可能是全世界最大的后门 /心跳服务器:)

    time.windows.com
    time.apple.com
    time.android.com
    ovear
    ovear
    May 22, 2017❤️1
    8
    onion83
    onion83
    May 22, 2017
    9
    @ovear 这个应该知道,主要是没有情怀和信仰值。
    mengzhuo
    mengzhuo
    May 22, 2017
    10
    @misaka19000

    http://www.ntp.org/ntpfaq/NTP-s-compat.htm#S-COMPAT-PLL

    学术不精,搞错名字……应该是 PPL
    mengzhuo
    mengzhuo
    May 22, 2017
    11
    @onion83

    他们三家都是 stratum 3,微软家不知道为什么,误差常年在 10ms 以上……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4774 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 01:58 · PVG 09:58 · LAX 17:58 · JFK 20:58
    ♥ Do have faith in what you're doing.