北京时间获取接口:
苏宁接口:http://quan.suning.com/getSysTime.do
淘宝接口:http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp

Linux系统时间设置:

/* 1. apply system time */;
 cur_time = atoll(timestamp);
 printf("cur_time: %lld\n", cur_time);
 tm.tv_sec = cur_time / 1000;
 tm.tv_usec = cur_time % 1000;
 settimeofday(&tm, NULL);

ntpd 同步系统时间:

busybox ntpd -p ntp1.aliyun.com -qNn
while [ $? -ne 0 ]; do
    echo "ntpd update."
    sleep 1s
    busybox ntpd -p ntp1.aliyun.com -qNn
done
hwclock -w

同步时区,把ubuntu系统的文件拷贝到工程目录里面,cp /usr/share/zoneinfo/Asia/Shanghai common/root/etc/localtime

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐