LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pb with converting Date/Time to seconds

Hello everyone,
 
I am using labview 8.5 and Windows XP. I have a problem with converting Date and Time to seconds. I have attached a VI in which I get a correct information before entering the Date/Time to Seconds Vi and a faulse info at the output of it. To be more precise, when I first run the VI, the Time/date in seconds has an1 hour offset. After the first time the conversion is correct.
 
Would anybody know what the problem is, and how I can get the corret info at the first run?
 
Thanks a lot,
 
Regards,
 
Marc
0 Kudos
Message 1 of 7
(3,796 Views)

Hi Marc,

what do you try to do? Can you please explain a little bit more, because from your code i´m not sure what you want?

Thanks
Mike

0 Kudos
Message 2 of 7
(3,787 Views)
Hi Marc,

the problem comes from DST (daylight savings time) flag and your use of locals...

In the first run the DST flag is unset, that's why you get a 1h offset as first result. In the second run the DST flag is set (from previous operation) and so you get the correct result without offset. You have to set the DST flag also on first call!

As your time string format is different to my computer's setting I had to change the string scan routine...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(3,777 Views)

Hi GerW,

Thank you very much for your answer (and taking time to change the scan routing to be able to run my VI.). It know works perfectly.

I know you have explained why, but I still don't get why in my previous program, the DST is set (default) to winter and then changes it self to summer (1) after the first run? (I understant I had forget to set this info but why does it change?)

Thanks to you and mike for your time.

 

PS : Mike, this is just a little part of a program in which I need to get the following minute with 0 seconds (12:43:13------> 12:44:00). I convert the 12:43:13 to seconds, add 60, and then go back to the 12:44:13 format and replace 13 by 00. I suppose there are more elegants way of doing this but it works....lol

0 Kudos
Message 4 of 7
(3,767 Views)
Hi Marc,

LabView is calculating and setting this flag - the same applies to "day of week" and "week of year": both get set in the conversion function and will be used as default for the next run of the vi...

The solution to your problem would be to wire a constant instead of a local to the bundle by name function. This way you have to set all items in the cluster and don't forget about those "unimportant" itemsSmiley Wink

Edited:
What about the usual way of rounding: divide by 60, round to nearest, multiply by 60 to get full minutes in the timestamp?


Message Edited by GerdW on 04-28-2008 02:33 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 7
(3,757 Views)
Hi Marc,

use "round to next integer" instead of "round to nearest" to get next full minute...Smiley Very Happy
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(3,746 Views)

Hi GerW,

Thanks for your explanation and your usual way of rounding solution !

Best regards,

Marc

0 Kudos
Message 7 of 7
(3,712 Views)