Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

'RT Set Date and Time.vi' Does not effect fractional second value? (milliseconds)

I have been trying to develop something that sets the system time on my cRIO RT system accurately. It appears the 'RT Set Date and Time.vi' does not set the millisecond value of the system timestamp. It keeps the fractional second value but sets the hour, minute, and second fields. Is this right??

This is what it appears to do.

Say the timestamp is currently 8:32:04.2324 and I use the 'RT Set Date and Time.vi' to set the time to 8:35:28. Instead of setting the time to 8:35:28.0000 it sets the time to 8:35:28.2324, keeping the millisecond value of the old timestamp value of the system clock intact! This means that I can only set the clock accurate to the nearest second!

Is there a way around this? Is there a way to set the millisecond value of the system time? Even if I just wanted to set it back to .000?

Help


---------------------------------
[will work for kudos]
0 Kudos
Message 1 of 7
(5,535 Views)

Hi Rex,

I posted on your other thread, but just for everyone else here is what I posted:

As you currently noticed the LabVIEW RT Set Date and Time does not allow you to set the time with ms resolution.  I ran into this a while back and after some investigation I found VxWorks does allow setting the time with a function call called :  clock_settime()
 
The time format is:
U32 seconds and  nanoseconds since midnight UTC of January 1, 1970, not counting leap seconds.
in the following struct:
struct timespec
    {
    long      tv_sec;         /* seconds */
    long        tv_nsec;        /* nanoseconds (between 0 and 1,000,000,000) */
    };
 
You can call this with a Call Library Node in LabVIEW provided you'll need to make a fake (stub) LabVIEW.dll on the host that defines this function so the CLN will configure properly. It will only work on the RT target (VxWorks or 901x targets), not on the host, since the host has a stub.

A little more on a Stub: "Compile a stub DLL using the same function prototypes as those exported by the *.out shared library. A stub DLL typically only contains the function prototype themselves without any implementation (ie, empty functions.) This stub DLL will only be used on your Windows host machine, and must have the same name as the original *.out shared library -- for example: foo.dll and foo.out. "
 
 Hope that helps,
 
Basset Hound


Message Edited by Bassett Hound on 03-28-2008 09:57 AM
0 Kudos
Message 2 of 7
(5,517 Views)

I haven’t tried it, but perhaps this link will help

 

http://zone.ni.com/devzone/cda/epd/p/id/5846

 

Terje

Message 3 of 7
(5,497 Views)
I love you guys! I am so going to try this and let you know. We had started to move away from the idea because of this hurtle but I am going to see if this works.

But I do have some quick questions. (warning: questions may reflect my labview noobness)

How do I do this? "You can call this with a Call Library Node in LabVIEW provided you'll need to make a fake (stub) LabVIEW.dll on the host that defines this function so the CLN will configure properly. It will only work on the RT target (VxWorks or 901x targets), not on the host, since the host has a stub."

How do I make a 'fake stub'? Do I need a host-target architecture rather than just running a vi on the 9104? Do you think you could post some code or something? You confused the hell out of me.



Message Edited by rex1030 on 04-03-2008 03:29 PM
---------------------------------
[will work for kudos]
0 Kudos
Message 4 of 7
(5,466 Views)
One more question...

And that documentation says this code will only work on VXWorks targets. What is a VXWorks target and will this run on my 9104?


Message Edited by rex1030 on 04-03-2008 03:36 PM
---------------------------------
[will work for kudos]
0 Kudos
Message 5 of 7
(5,460 Views)

Hi rex1030.

VxWorks is a real-time operating system and is used on the cRIO-9012 and cRIO-9014.

cRIO-9002 and cRIO-9004 is running Pharlap and the mentioned method can not be used with these modules. (As is described here: http://forums.ni.com/ni/board/message?board.id=280&thread.id=3577)

 

cRIO-9104 is a chassis that can be used with all there controllers so to see if you can use this method you have to check the controller.

 

Terje   

0 Kudos
Message 6 of 7
(5,456 Views)
so... how do I make a fake stub that will make this VI work?

---------------------------------
[will work for kudos]
0 Kudos
Message 7 of 7
(5,392 Views)