LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Timestamp control with current time

Im trying to create a labview program where the user can set the time for a led to be triggered. I want to compare the time the user has selected to the current time but cant seem to get this working. I also want to do it without using the date, seeing as this is going to be a daily event. 

This is what I got, but cant make the time match:

 

 

0 Kudos
Message 1 of 5
(3,958 Views)

Think about what you are asking.  You want to compare two TimeStamps, which represent instants in time (that, of course, includes the date, since an instant yesterday can never match an instant today -- it is forever "yesterday").  The TimeStamp represents this instant as precisely as possible, perhaps down to the nanosecond.

 

What question do you want to ask?  How closely do you want to "match" a time (to the hour, minute, second, millisecond, microsecond)?  Do you want just time (as you state)?  Can you think of how you would compare the TimeStamp representing 10:13am yesterday with the TimeStamp of 10:13am today?  [Hint -- what is the difference between them, and can you generalize this question?].

 

Bob Schor 

0 Kudos
Message 2 of 5
(3,942 Views)

It just occurred to me that I can format the timestamp:)

0 Kudos
Message 3 of 5
(3,937 Views)

Yes, you could do that.  You could also use LabVIEW Help to see that a TimeStamp is a number that represents something.  If you have numbers, you can do arithmetic on them.  If you want to see if two numbers are equal, you can compare them.  If the two numbers happen to not be integers, then you need to understand what it means to compare them.

 

"LabVIEW calculates this timestamp using the number of seconds elapsed since 12:00 am, Friday, January 1, 1904, Universal Time".

 

Bob Schor 

 

 

0 Kudos
Message 4 of 5
(3,932 Views)

The attached VI could work  if just compare time.

0 Kudos
Message 5 of 5
(3,578 Views)