QNX 6.3.0 gcc 3.3.1

git-svn-id: svn://db.shs.com.ru/pip@212 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2016-07-26 13:08:49 +00:00
parent 4c30988c77
commit d951871dec
4 changed files with 46 additions and 22 deletions

View File

@@ -50,11 +50,11 @@ void piUSleep(int usecs); // on !Windows consider constant "usleep" offset
/*! \brief Precise sleep for "msecs" milliseconds
* \details This function exec \a piUSleep (msecs * 1000). */
inline void piMSleep(double msecs) {piUSleep(msecs * 1000);} // on !Windows consider constant "usleep" offset
inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Windows consider constant "usleep" offset
/*! \brief Precise sleep for "secs" seconds
* \details This function exec \a piUSleep (msecs * 1000000). */
inline void piSleep(double secs) {piUSleep(secs * 1000000);} // on !Windows consider constant "usleep" offset
inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset
class PIP_EXPORT PISystemTime {
public:
@@ -151,16 +151,16 @@ public:
//! Contructs system time from seconds "v"
static PISystemTime fromSeconds(double v) {int s = piFloord(v); return PISystemTime(s, (v - s) * 1000000000);}
static PISystemTime fromSeconds(double v) {int s = piFloord(v); return PISystemTime(s, int((v - s) * 1000000000.));}
//! Contructs system time from milliseconds "v"
static PISystemTime fromMilliseconds(double v) {int s = piFloord(v / 1000.); return PISystemTime(s, (v / 1000. - s) * 1000000000);}
static PISystemTime fromMilliseconds(double v) {int s = piFloord(v / 1000.); return PISystemTime(s, int((v / 1000. - s) * 1000000000.));}
//! Contructs system time from microseconds "v"
static PISystemTime fromMicroseconds(double v) {int s = piFloord(v / 1000000.); return PISystemTime(s, (v / 1000000. - s) * 1000000000);}
static PISystemTime fromMicroseconds(double v) {int s = piFloord(v / 1000000.); return PISystemTime(s, int((v / 1000000. - s) * 1000000000.));}
//! Contructs system time from nanoseconds "v"
static PISystemTime fromNanoseconds(double v) {int s = piFloord(v / 1000000000.); return PISystemTime(s, (v / 1000000000. - s) * 1000000000);}
static PISystemTime fromNanoseconds(double v) {int s = piFloord(v / 1000000000.); return PISystemTime(s, int((v / 1000000000. - s) * 1000000000.));}
//! Returns current system time
static PISystemTime current(bool precise_but_not_system = false);

View File

@@ -268,24 +268,32 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
}
#else
# ifdef QNX
struct dirent * de = 0;
DIR * dir = 0;
dir = opendir(p.data());
if (dir) {
for (;;) {
de = readdir(dir);
if (!de) break;
l << PIFile::fileInfo(dp + PIString(de->d_name));
}
closedir(dir);
}
# else
dirent ** list;
int cnt = scandir(
# ifndef QNX
p.data(), &list
# else
const_cast<char*>(p.data()), 0
# endif
, 0,
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY)
int cnt = scandir(p.data(), &list, 0,
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY) || defined(QNX)
alphasort);
# else
# else
versionsort);
# endif
# endif
for (int i = 0; i < cnt; ++i) {
l << PIFile::fileInfo(dp + PIString(list[i]->d_name));
free(list[i]);
}
free(list);
# endif
#endif
// piCout << "end entries from" << p;
return l;

View File

@@ -21,8 +21,18 @@
#include "piconfig.h"
#include "pisysteminfo.h"
#ifdef QNX
# include <net/if.h>
# include <net/if_dl.h>
# include <hw/nicinfo.h>
# include <netdb.h>
# include <sys/socket.h>
# include <sys/time.h>
# include <sys/types.h>
# include <sys/ioctl.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <ifaddrs.h>
# include <fcntl.h>
# ifdef BLACKBERRY
# include <netinet/in.h>
# else
@@ -304,14 +314,14 @@ void PIEthernet::applyTimeout(int fd, int opt, double ms) {
if (fd == 0) return;
//piCoutObj << "setReadIsBlocking" << yes;
#ifdef WINDOWS
DWORD tm = ms;
DWORD _tm = ms;
#else
double s = ms / 1000.;
timeval tm;
tm.tv_sec = piFloord(s); s -= tm.tv_sec;
tm.tv_usec = s * 1000000.;
timeval _tm;
_tm.tv_sec = piFloord(s); s -= _tm.tv_sec;
_tm.tv_usec = s * 1000000.;
#endif
ethSetsockopt(fd, SOL_SOCKET, opt, &tm, sizeof(tm));
ethSetsockopt(fd, SOL_SOCKET, opt, &_tm, sizeof(_tm));
}

View File

@@ -170,7 +170,13 @@ inline PIByteArray & operator >>(PIByteArray & s, complexld & v) {ldouble t; s >
void randomize();
// [-1 ; 1]
inline double randomd() {return (double)random() / RAND_MAX * 2. - 1.;}
inline double randomd() {return (double)
#ifdef QNX
rand()
#else
random()
#endif
/ RAND_MAX * 2. - 1.;}
// [-1 ; 1] normal
double randomn(double dv = 0., double sv = 1.);