FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting PC Time

Hey all,

I am new to LabView and I had a quick question.  Is it possible to set the time on a PC within the LabVIEW environment?  I am going to be receiving gps time stamps through the serial port and would like to adjust the PC's time and date to the gps values.  Let me know if you guys have any suggestions or ideas.

Thanks,
Jared Lucey
0 Kudos
Message 1 of 9
(5,144 Views)

If you are using windows, you can use the "time" command by calling System Exec (Communications palette).

It appears you can't call the command yourself, but you can use the windows command prompt to call it. To do so, wire "Cmd /c time 23:59:59" into System Exec (obviously with your own time). The /c switch causes the string following it to be executed as a command.

Since you posted in the FieldPoint board, if you have any RT software installed, you can also use the Set Date and Time VI from the RT palette. It works on PCs just as well.


___________________
Try to take over the world!
Message 2 of 9
(5,133 Views)

That was great answer.

Here is an example VI to get you started.

Kalyan

 

 

Applications Engineer
National Instruments
0 Kudos
Message 3 of 9
(5,120 Views)
Hey guys,

Thank you for the great feedback, I am going to check out your ideas and see if I can get them working.

Thanks,
Jared Lucey
0 Kudos
Message 4 of 9
(5,119 Views)

You can also call the Windows API function (SetSystemTime) to set the date and time.  See attached VI.

-Khalid

PS: Note that the time set is UTC/GMT time.

Message 5 of 9
(5,113 Views)

Thanks, Khalid.

I actually did a quick search to see if I could find a windows function, but didn't.


___________________
Try to take over the world!
0 Kudos
Message 6 of 9
(5,109 Views)

Dear Khalid,

            As to change the system time, is it possible to time zone also??? cos we could get the data either in the GMT or in the Local Standard time, and it all depends on the user, so is it also possible to change the time zone from the LabVIEW?

Thanks,

Nishant

0 Kudos
Message 7 of 9
(4,768 Views)

Hi Nishant,

I believe so.  There's a windows function to set and get the timezone info'.  I am attaching a half-finished VI to get the time zone info'.   Maybe you can use this as a starting point for the set function. 

Good luck!

-Khalid

Message Edited by Khalid on 11-14-2006 05:33 PM

0 Kudos
Message 8 of 9
(4,754 Views)

I found this topic while doing a search for a related topic.  I was wondering if anyone would be kind enough to re-post the three vi's previously posted here in Labview 7.0?  I tried opening them, but they appear to be in version 7.1. 

 

I know it is a random thing to ask, but I appreciate any help.  Thanks.

 

 

Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 9 of 9
(3,899 Views)