乔自己的ntp date:通过ntp设置日期和时间
joes-ntpdate的Python项目详细描述
Joe自己的ntpdate
通过NTP设置日期和时间。
假设BSD或GNU日期(1)和GNU硬件时钟(8)(如适用)。
这个实现不会乱来。它需要根权限, 并将操作系统和硬件时钟设置为任何值 由给定的NTP服务器找到。
usage: joes-ntpdate [-h] [--set-system] [--set-hwclock] [--retries [N]] [--backoff-factor N] [ntp_host] Joe's own ntpdate: report or set clock by remote ntp host. positional arguments: ntp_host remote ntp host to synchronize clock with. (default: pool.ntp.org) optional arguments: -h, --help show this help message and exit --set-system Set system clock to remote time. (default: False) --set-hwclock additionally, set hardware clock. May do nothing on platforms without hwclock(8) (default: False) --retries [N] retry on failure up to N times. (default: 30) --backoff-factor N retry backoff each step, sleep for {{<backoff-factor> * <retry-step>}} (default: 2.0) Assumes bsd or gnu date(1) and gnu hwclock(8) if applicable.
这个包使用ntplib