Jump to content

Problem comparing timestamps


Recommended Posts

Hi,

I have two timestamps which are both calculated based on the t0 and dt of the same waveform (only diferent subvi/location).

both were attached to an in range check and i noticed the lower limit became out of range.

I copied the (equal) data from my probes to the attached vi (LV 8.5) for further testing and noticed the equal failed on the timestamp,

but converting to DBL or EXT resulted in an equal timestamp.

post-2311-051410900 1276596420_thumb.png

I fixed my code by first converting to DBL before doing the compare, but I was wondering if someone has an idea what is causing this.

Timestamp problem.vi

Thanks

Link to comment

Hi,

I have two timestamps which are both calculated based on the t0 and dt of the same waveform (only diferent subvi/location).

both were attached to an in range check and i noticed the lower limit became out of range.

I copied the (equal) data from my probes to the attached vi (LV 8.5) for further testing and noticed the equal failed on the timestamp,

but converting to DBL or EXT resulted in an equal timestamp.

post-2311-051410900 1276596420_thumb.png

I fixed my code by first converting to DBL before doing the compare, but I was wondering if someone has an idea what is causing this.

Timestamp problem.vi

Thanks

AFAIK timestamp is a 128-bit fixed precision type with 64 bits for seconds after 1.1.1904 and 64 bits for fractions of the second. My guess is that simply converting to DBL or EXT gives the same number, because for values >1 the precision of DBL and EXT is much smaller than for numbers (0..1). Try subtracting both timestamps (the result is a double) and comparing that to 0. For number <1 the precision is much higher and you should see the actual difference.

Br, Mike

Link to comment

Hi,

I fixed my code by first converting to DBL before doing the compare, but I was wondering if someone has an idea what is causing this.

Timestamp problem.vi

AFAIK timestamp is a 128-bit fixed precision type with 64 bits for seconds after 1.1.1904 and 64 bits for fractions of the second. My guess is that simply converting to DBL or EXT gives the same number, because for values >1 the precision of DBL and EXT is much smaller than for numbers (0..1). Try subtracting both timestamps (the result is a double) and comparing that to 0. For number <1 the precision is much higher and you should see the actual difference.

Br, Mike

The exact difference between the two timestamps is 786 out of 2^64 of a second (4,16334E-17).

post-2399-089200000 1276624878_thumb.png

Ton

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.