tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] sleep() interprets argument as milliseconds instead of se


From: Hernán J . González
Subject: [Tinycc-devel] sleep() interprets argument as milliseconds instead of seconds
Date: Tue, 29 Nov 2016 16:52:44 -0300

The POSIX sleep()  function ( <unistd.h>) should interpret is input argument as seconds.
TinyC seems to interpret it as milliseconds.

Using tcc version 0.9.26

/*******************************/
#include<stdio.h>
#include <unistd.h>
int main() {
  int i;
  fputs("Looping ...\n",stdout);
  for(i=0;i<10;i++) {
    fputs(".",stdout);
    fflush(stdout);
    sleep(3); // seconds?
  }
  return 0;
}
/*******************************/

Expected behaviour: This should print a dot at 3 seconds interval, the loop should take 30 seconds.
Result: The 10 dots are printed and the loop ends  almost instanteously. Expected behaviour is attained when replacing '3' by '3000'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]