jetson-utils icon indicating copy to clipboard operation
jetson-utils copied to clipboard

timeAdd() is incorrect resulting in Event::Wait() with timeout never timing out

Open jarnovanderlinden opened this issue 5 years ago • 2 comments

The timeAdd() function in timespec incorrectly calculates the carry from nsec to sec.

const time_t sec=t.tv_nsec/1e-9;
t.tv_sec+=sec;
t.tv_nsec-=sec*1e-9;

should probably be:

const time_t sec=t.tv_nsec/1e9;
t.tv_sec+=sec;
t.tv_nsec-=sec*1e9;

As this is used with the timeout versions of Event::Wait(), which in turn is used is gstCamera::Capture(), this bug makes the capture practically never time out.

jarnovanderlinden avatar Dec 06 '19 13:12 jarnovanderlinden

Hi @jarnovanderlinden, sorry about that - I had previously patched this in commit 6c8b6b to jetson-utils. So if you pull the latest jetson-utils into your repo and recompile, it should be fixed.

$ cd jetson-inference/utils
$ git pull origin master
$ cd ../build
$ cmake ../
$ make
$ sudo make install

Let me know if you still have an issue with it.

dusty-nv avatar Dec 06 '19 15:12 dusty-nv

Ah thank you. That does indeed fix it. I missed the patches as I got here from jetson-inference, which uses an older revision.

jarnovanderlinden avatar Dec 07 '19 01:12 jarnovanderlinden