kkamikakoi / btstack

Automatically exported from code.google.com/p/btstack
0 stars 0 forks source link

a little bug in function posix_execute() #355

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Related code as follows:
            while (next_tv.tv_usec < 0){
                next_tv.tv_usec += 1000000;
                next_tv.tv_sec--;
            }
            if (next_tv.tv_sec < 0 || (next_tv.tv_sec == 0 && next_tv.tv_usec < 0)){
                next_tv.tv_sec  = 0; 
                next_tv.tv_usec = 0;
            }

the "while" line ensure "next_tv.tv_usec >= 0", so, the "next_tv.tv_usec < 0" 
judgement on "if" line may never be true.

the correct line may as follows:
            if (next_tv.tv_sec < 0 || (next_tv.tv_sec == 0 && next_tv.tv_usec == 0)){

Original issue reported on code.google.com by wmy...@126.com on 7 Nov 2013 at 2:56

GoogleCodeExporter commented 8 years ago
that's correct. the whole second part is then useless. see commit 2011. thanks!

Original comment by matthias.ringwald@gmail.com on 19 Dec 2013 at 10:53