tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] sleep() interprets argument as milliseconds instead o


From: Steven G. Messervey
Subject: Re: [Tinycc-devel] sleep() interprets argument as milliseconds instead of seconds
Date: Tue, 29 Nov 2016 23:05:13 -0500

 

 

From: Tinycc-devel [mailto:address@hidden On Behalf Of Hernán J. González
Sent: Tuesday, November 29, 2016 2:53 PM
To: address@hidden
Subject: [Tinycc-devel] sleep() interprets argument as milliseconds instead of seconds

 

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'

 

 

I cannot reproduce, tinycc 0.9.26, Debian 8 ‘Jessie’,

Linux sgmtech8 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux,

no ‘configure’ flags at all, just ./configure ; make; sudo make install

 

My simple test was just:

sl.c

---code---

#include <stdio.h>

#include <unistd.h>

 

int main(int argc, char **argv) {

  sleep(3);

  return 0;

}

--- end code---

$time ./sl

 

real    0m3.001s

user    0m0.000s

sys     0m0.000s

 

Maybe it’s distro-related?

 


reply via email to

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