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:
@@ -50,11 +50,11 @@ void piUSleep(int usecs); // on !Windows consider constant "usleep" offset
|
|||||||
|
|
||||||
/*! \brief Precise sleep for "msecs" milliseconds
|
/*! \brief Precise sleep for "msecs" milliseconds
|
||||||
* \details This function exec \a piUSleep (msecs * 1000). */
|
* \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
|
/*! \brief Precise sleep for "secs" seconds
|
||||||
* \details This function exec \a piUSleep (msecs * 1000000). */
|
* \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 {
|
class PIP_EXPORT PISystemTime {
|
||||||
public:
|
public:
|
||||||
@@ -151,16 +151,16 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//! Contructs system time from seconds "v"
|
//! 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"
|
//! 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"
|
//! 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"
|
//! 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
|
//! Returns current system time
|
||||||
static PISystemTime current(bool precise_but_not_system = false);
|
static PISystemTime current(bool precise_but_not_system = false);
|
||||||
|
|||||||
@@ -268,15 +268,22 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
dirent ** list;
|
# ifdef QNX
|
||||||
int cnt = scandir(
|
struct dirent * de = 0;
|
||||||
# ifndef QNX
|
DIR * dir = 0;
|
||||||
p.data(), &list
|
dir = opendir(p.data());
|
||||||
|
if (dir) {
|
||||||
|
for (;;) {
|
||||||
|
de = readdir(dir);
|
||||||
|
if (!de) break;
|
||||||
|
l << PIFile::fileInfo(dp + PIString(de->d_name));
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
# else
|
# else
|
||||||
const_cast<char*>(p.data()), 0
|
dirent ** list;
|
||||||
# endif
|
int cnt = scandir(p.data(), &list, 0,
|
||||||
, 0,
|
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY) || defined(QNX)
|
||||||
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY)
|
|
||||||
alphasort);
|
alphasort);
|
||||||
# else
|
# else
|
||||||
versionsort);
|
versionsort);
|
||||||
@@ -287,6 +294,7 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
|
|||||||
}
|
}
|
||||||
free(list);
|
free(list);
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
// piCout << "end entries from" << p;
|
// piCout << "end entries from" << p;
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,18 @@
|
|||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#ifdef QNX
|
#ifdef QNX
|
||||||
|
# include <net/if.h>
|
||||||
# include <net/if_dl.h>
|
# include <net/if_dl.h>
|
||||||
# include <hw/nicinfo.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
|
# ifdef BLACKBERRY
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
# else
|
# else
|
||||||
@@ -304,14 +314,14 @@ void PIEthernet::applyTimeout(int fd, int opt, double ms) {
|
|||||||
if (fd == 0) return;
|
if (fd == 0) return;
|
||||||
//piCoutObj << "setReadIsBlocking" << yes;
|
//piCoutObj << "setReadIsBlocking" << yes;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
DWORD tm = ms;
|
DWORD _tm = ms;
|
||||||
#else
|
#else
|
||||||
double s = ms / 1000.;
|
double s = ms / 1000.;
|
||||||
timeval tm;
|
timeval _tm;
|
||||||
tm.tv_sec = piFloord(s); s -= tm.tv_sec;
|
_tm.tv_sec = piFloord(s); s -= _tm.tv_sec;
|
||||||
tm.tv_usec = s * 1000000.;
|
_tm.tv_usec = s * 1000000.;
|
||||||
#endif
|
#endif
|
||||||
ethSetsockopt(fd, SOL_SOCKET, opt, &tm, sizeof(tm));
|
ethSetsockopt(fd, SOL_SOCKET, opt, &_tm, sizeof(_tm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,13 @@ inline PIByteArray & operator >>(PIByteArray & s, complexld & v) {ldouble t; s >
|
|||||||
void randomize();
|
void randomize();
|
||||||
|
|
||||||
// [-1 ; 1]
|
// [-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
|
// [-1 ; 1] normal
|
||||||
double randomn(double dv = 0., double sv = 1.);
|
double randomn(double dv = 0., double sv = 1.);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user