From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-06-2011 05:31 AM
I have a problem which I am stuggeling to get right.
At a certain time of the day, the process must run a verification sequence which must be completed.
I was thinking about using two time values, the one being the actual time and the other being the target time. Once the actual time is equal or more than the target time, some code must run. This code must run (verification sequence) before any other code can run.
Please any advice would greatly be appreciated
01-06-2011 05:35 AM
It will work.
And if you want you can keep this code in other loop so as your main code will also run in parallel with this conditional code.
Provided if you don't want other execution to stop when your conditional code is running.
Best of luck
01-06-2011 06:18 AM
Mainly what I want to know is how to compare the dates, set time and the actual time.
I am having trouble with this bit, the rest I would hopefully figure out
01-06-2011 06:45 AM
You can compare dates using the numeric operators. Subtract The actual time from the set time. This will return the seconds difference.
If the result is < 0, then you can execute your conditional code. You can then add 1 day to your set time and continue comparing.
See Jim Kring's blog entry LabVIEW tip: easy relative timestamp calculations
01-06-2011 06:46 AM
Hein,
This will be true when current time is equal or greater then the set time:
Rgs,
Lucither
01-06-2011 07:43 AM - edited 01-06-2011 07:50 AM
@Lucither wrote:
Hein,
This will be true when current time is equal or greater then the set time:
Rgs,
Lucither
The suggestion above are correct in answer the question "how to compare times?" but there is an ancillary question that goes with this challenge that being "What time value do I compare with the current time?"
Sounds simple at first glance and in most situations is a no-brainer UNLESS your app is a 24X7 365 day never go down app. In that case you have to deal with Daylight savings time (Lets ignore leap years seconds etc for now). With DST, we have to deal with the fact that there is one day with 23 hours and another day with 25 hours. One of those days does not have a "2 O-clock" times and the other has two, one with DST true and another with DST false. The other complication that coes with that fact is that (in the US at least) the dates on which those 23 and 25 hour days occur are defined by the whims of governement ("Those who seek to change times and way.." Is that reveleations?) so you can't code for changes ahead of time.
If you get past that challenge, the other thing to take note of is that Windows displays the creation date of files in the current time (DST T/F) so a file created at 1:00 last night may have a creation time of 2:00.
I hope you don't have to deal with DST and if you do, at least you have been warned.
Ben
This thing all things devours:
Birds, beasts, trees, flowers;
Gnaws iron, bites steel;
Grinds hard stones to meal;
Slays king, ruins town,
And beats high mountain down.
01-08-2011 02:34 AM
01-08-2011 09:38 AM
@Ben wrote:
Lucither wrote:
The suggestion above are correct in answer the question "how to compare times?" but there is an ancillary question that goes with this challenge that being "What time value do I compare with the current time?"
Sounds simple at first glance and in most situations is a no-brainer UNLESS your app is a 24X7 365 day never go down app. In that case you have to deal with Daylight savings time (Lets ignore leap years seconds etc for now).
I hope you don't have to deal with DST and if you do, at least you have been warned.
One thing to note, the LabVIEW timestamp-data is DST unaware it is simply a time in UTC. The representation (a probe, an indicator, a control) is DST aware, you can however use UTC time. on the representation.
Ton