LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO timestamp problem

Hello!

I'm programming a cRIO which is supposed to acquire and log data in a stand-alone way. Date stamping of acquired data was working well some times ago, but it doesn't work any more.

Every time I start my app (from the development environment), the Get Date/Time In Seconds function returns date/times starting from Jan-1-1970 01.00.00. These timestamps are also returned for shared variables published by the cRIO.

However, if you check the system date/time using MAX, it's good.

I also tried to use the RT Set Date and Time vi with no impact on both the timestamps and the system time.

Any suggestion?

 

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 1 of 4
(3,483 Views)

Hi Paolo.  Does the cRIO controller you are using have a real-time clock?  Not all do, i.e. the 9074/9075 do not.  The clock on those always starts from the 1970 date from power up.

 

We had the same problem.  We solved it by:

 

1) queue data with current timestamp

2) do not allow PC to retrieve queued data until the PC has updated the cRIO clock

3) when the PC updates the cRIO clock, measure the offset in seconds between cRIO clock and PC time

4) as data is dequeued, add in the offset if the timestamp < Jan. 1 2010

 

Kind of kludgey, but it works well.

 

Matt

Message 2 of 4
(3,476 Views)

Thank you Matt for your help.

Actually, the reason of the problem was rather clumsy: an RT Set Date vi with no input wired was present on the block diagram Smiley LOL

However, the MAX screen kept showing the original date/time, so I guess that the system time and the Get Date/Time In Seconds output are not the same (???).

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 4
(3,460 Views)

Glad it was a simple fix.

 

In FieldPoint, there are really two clocks, I expect it is the same in cRIO.  Just like a PC, there is a hardware real-time clock, which remembers the time across power cycles (except the 9074/9075 and maybe some others) and then an OS clock, which gets set from the hardware clock at reboot.  If you are seeing two different times, my first guess is that the tools you are using to display the times are using two different sources.  I don't know where MAX gets timestamps, but my guess is from the hardware clock.  FP Read commands (in FieldPoint) return the time from the hardware clock, while most of the LabVIEW time functions return the OS time.  Can get interesting when the two start to diverge, or are just plain different, as you observed.

 

Matt

Message 4 of 4
(3,453 Views)