totalspectrum / flexprop

Simple GUI for Propeller development (both P1 and P2)
Other
38 stars 15 forks source link

loadp2 msleep function improvement #46

Closed rosco-pc closed 3 years ago

rosco-pc commented 3 years ago

in loadp2/osint_linux.c ftime is used to implement msleep function Trying to port flexprop to OpenBSD and this function (and related sys/timeb.h) has been removed a looong time ago there as it has been deprecated in POSIX standard. Even in Linux it is obsoleted according to the man page.

The usleep function it replaces is ALSO obsoleted and replaced by nanosleep instead as below. Sorry no patch/pull request and maybe too simplistic as it will fail horribly when using more then 999 ms. However for loadp2 it works without any problems on both OpenBSD and Linux (Mint & raspbian)

void msleep(int ms)
{
    struct timespec remaining, request = {0, ms * 1000000};
    nanosleep(&request, &remaining);
}

PS I'll come back with a pull request for all the changes needed to get it to compile on OpenBSD once I've completed it all. For now it is mainly in the Makefiles, but still struggling with proploader and port selection in flexprop (similar to MacOS though)

rosco-pc commented 3 years ago

Moved issue to loadp2 repo