LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Snamprogetti

Not a Timestamp?

Status: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.

I'd like a comparison block to tell us if a timestamp is a valid one or not.

By not valid i mean showing something like "DD/MM/YYYY" instead of mumbers, as a newly placed timestamp control does.

 

You can't just check "= 0" because actually an invalid timestamp could also be a NaN or any large positive/negative number!

6 Comments
AristosQueue (NI)
NI Employee (retired)

Drop a new Timestamp control and choose "Convert to Constant", then compare against that. That would seem to do exactly what you're asking for, right? If not, post some screenshots of other cases, please.

 

TimestampInvalid.png

(For the record, I have no idea how you would generate a Timestamp with a value of infinity. I tried and couldn't find any way to do that.)

 

Snamprogetti
Active Participant

No, that's the same as checking "= 0".

 

Use "To Time Stamp" or "Date/Time to Seconds" with unexpected values, and you may get an invalid timestamp that looks the same but does not equal 0

 

Immagine.PNG

PhillipBrooks
Active Participant

It seems to me that the problem is not in comparing a timestamp to a constant, but rather CONVERTING a "date time rec" cluster to a timestamp.

 

Date/Time to Seconds has rules regarding values passed in, but does not check the values. You need to validate the values in your own code.

 

http://zone.ni.com/reference/en-XX/help/371361E-01/glang/date_time_to_seconds/

 

 

AristosQueue (NI)
NI Employee (retired)

Why in the world don't we check for validity in the conversion functions? That sounds like a bug to me.

PhillipBrooks
Active Participant

@Aristos

 

I've seen some old code that added two 'date time rec" clusters. One cluster contained the current date and the other was a constant that contained all zeros except for the day component (set to 90) to calculate a calibration date.

 

DateTimeRec.jpg

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.