[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] nanosleep
On Sun, 20 Jan 2013 21:00:45 , Ole <ole@monochrom.net> wrote:
> Am Sonntag, den 20.01.2013, 20:13 +0100 schrieb Peter Slegg
> <p.slegg@scubadivers.co.uk>:
>
> > I am sure I must all ready have so I expect I am doing something
> > stupid in the makefile.
>
> Is nanosleep an definition or an inline function? If so, then it is
> required to include
> the correct header file and make sure it is not undeclared because of
> sime #ifdef's
>
> Greets,
> Ole
I believe it is a function in mintlib.
I reduce msleep.c to a simpler version. What does it have to include
to be able to use nanosleep ?
Regards,
Peter
#include <unistd.h>
#include <time.h>
#include "msleep.h"
#define M 1000000
void
msleep(unsigned long x)
{
unsigned long long n;
struct timespec t1;
n=M*x;
t1.tv_sec=n/(1000*M);
t1.tv_nsec=n%(1000*M);
nanosleep(&t1,0);
}
lo