Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TZ环境变量设置有误 #7

Open
tsingakbar opened this issue Jul 25, 2022 · 0 comments
Open

TZ环境变量设置有误 #7

tsingakbar opened this issue Jul 25, 2022 · 0 comments

Comments

@tsingakbar
Copy link

首先看一下TZ的定义,offset部分的含义是“localtime加上offset,得到UTC时间”。

timezone = t2 >= t1 ? (t2 - t1) / 3600 : (t1 - t2) / 3600;

这里直接用的绝对值,这样东西半球肯定有一半是不对的。哪怕是只考虑东八区,这里会设置TZ=UTC8,设置完之后,含义就是“本地+8小时=UTC时间”,而东八区是“本地-8小时=UTC时间”,一来一回,会差16个小时。

此外除了swift驱动,genaral驱动也都返回的是TAI时间,和UTC时间存在闰秒差。我们的使用场景中是通过ptp时钟源给lidar授时的,而ptp时钟源本来是提供了currentUtcOffset字段,方便TAI时间转换成UTC时间的;而到了我们使用lidar的时候,这个TAI转UTC的问题就成了业务方的了,而业务方因为不直接和ptp时钟源交互,只能写死一个当前正确的值(例如2022年的值是37),但是一旦突然要加闰秒,业务方的代码就有问题了,这里希望厂商可以支持ptp时钟源的currentUtcOffset字段,做闰秒补偿。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant