iarasi intervin... (nesolicitat, ca si data trecuta...)<br><br>nu e mai simplu cu usleep ?<br>chiar daca usleep e obsolete....<br><br>void usleep(unsigned long usec);<br><br>$ cat /usr/include/limits.h | grep ULONG<br># define ULONG_MAX 4294967295UL<br><br>usleep( (unsigned long) ms * 1000) sau ceva de genu' ar trebui sa mearga ca uns...<br> <br><b><i>Marius Nicolae <mariusn007@gmail.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> On Nov 16, 2007 10:17 PM, Catalin Iacob <iacobcatalin@gmail.com> wrote:<br>> On Friday 16 November 2007 22:03:34 Marius Nicolae wrote:<br>> > Pai nici nu trebuie sa fac un sleep, am dormit deja x secunde cu<br>> > sleep(ms/1000).<br>><br>> Nu prea am urmarit thread-ul fiindca s-au intins foarte tare discutiile.<br>><br>> Dar aici gresesti. Operatorul / in C/C++ iti face impartire intreaga.<br>> Daca
ms == 500 rezultatul 500/1000 == 0. Deci nu dormi deloc.<br>> Similar, daca ms == 1900, 1900 / 1000 == 1 deci in loc de aproape 2 secunde<br>> dormi una singura.<br>><br>> Nu stiu daca asta e problema ta (sau daca tu erai cel cu problema :D) dar<br>> sleep(ms / 1000) suna gresit.<br><br>Poate asa e mai clar:<br><br>{<br> sleep(ms/1000);<br> usleep(ms%1000*1000);<br>}<br><br>Pentru ms==1900,<br>prima instructiune este sleep(1) - doarme o secunda<br>a doua instructiune este sleep(900000) - doarme 900 milisecunde<br>--------------<br>Total: 1900 ms<br><br>><br>> Catalin<br>><br>> _______________________________________________<br>> so mailing list<br>> so@cursuri.cs.pub.ro<br>> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so<br>><br>_______________________________________________<br>so mailing
list<br>so@cursuri.cs.pub.ro<br>http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so<br></iacobcatalin@gmail.com></blockquote><br><p> 
<hr size=1>Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. <a href="http://us.rd.yahoo.com/evt=51732/*http://overview.mail.yahoo.com/">See how.</a>