取消
显示结果 
搜索替代 
您的意思是: 

Convert Unix timestamp to LabVIEW time

已解决!
转到解答

Hello

I need to convert a Unix timestamp comming froma dll to a LabVIEW time. Does anybody now some ready to use function for this?

Thanks

 

1 条消息(共 5 条)
8,048 次查看
解答
已被主题作者 DAckermann 接受

What is the datatype of the unix timestamp?

 

The epoch of unix is 1/1/1970.

The epoch of LabVIEW is 1/1/1904

 

All you need to add is the number of seconds between the two epochs (i.e. the value of a LabVIEW timestamp of 1/1/1970)

2 条消息(共 5 条)
8,045 次查看

Oh yes. That was easy.

 

Thank you very much!

0 项奖励
3 条消息(共 5 条)
7,991 次查看

@DAckermann wrote:

Oh yes. That was easy.

 

Thank you very much!


Exceot that there is a small possible gotcha. If you enter 1/1/1970 in a LabVIEW timestamp control and convert this to a double to get the number of seconds you likely end up with an error of your local timezone offset.

Both the Unix and LabVIEW epoch are defined respective to GMT which for most practical purposes is the same as UTC. So you have to make sure to get the number of seconds for a timestamp that shows 1/1/1970 00:00 UTC to be right.

 

破坏者
If you ended up with 2082844800 as offset then you got it right.
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
4 条消息(共 5 条)
7,942 次查看

I cannot express how much this little hint means to me. Thank you so much!

 

Here is a screenshot of a TimeStamp Constant, where I changed the Display Format to show UTC and then the magical 1h appeared. It haunted me for days, that my data appeared to be in the future in my database, when I was sending the Time as a UNIX Timestamp.

0 项奖励
5 条消息(共 5 条)
1,812 次查看