1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-08 08:54:49 -04:00

qrtplib: draft (2)

This commit is contained in:
f4exb
2018-02-25 19:31:15 +01:00
parent 96014f0efb
commit b8147ffacc
9 changed files with 1107 additions and 58 deletions
+11 -22
View File
@@ -9,7 +9,7 @@
This library was developed at the Expertise Centre for Digital Media
(http://www.edm.uhasselt.be), a research center of the Hasselt University
(http://www.uhasselt.be). The library is based upon work done for
(http://www.uhasselt.be). The library is based upon work done for
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,13 +35,11 @@
#include "rtprandom.h"
#include "rtprandomurandom.h"
#include "rtprandomrand48.h"
#include <time.h>
#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include <stdlib.h>
#endif // WIN32
#include <unistd.h>
#include <QDateTime>
//#include "rtpdebug.h"
@@ -51,24 +49,15 @@ namespace qrtplib
uint32_t RTPRandom::PickSeed()
{
uint32_t x;
// TODO: do it for MinGW see sdrbase/util/uid.h,cpp
x = (uint32_t) getpid();
QDateTime currentDateTime = QDateTime::currentDateTime();
x += currentDateTime.toTime_t();
#if defined(WIN32)
x = (uint32_t)GetCurrentProcessId();
FILETIME ft;
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st,&ft);
x += ft.dwLowDateTime;
x ^= (uint32_t)((uint8_t *)this - (uint8_t *)0);
x += QDateTime::currentMSecsSinceEpoch() % 1000;
#else
x = (uint32_t)getpid();
x += (uint32_t)time(0);
x += (uint32_t)clock();
x ^= (uint32_t)((uint8_t *)this - (uint8_t *)0);
#endif
x ^= (uint32_t)((uint8_t *)this - (uint8_t *)0);
return x;
}
@@ -82,7 +71,7 @@ RTPRandom *RTPRandom::CreateDefaultRandomNumberGenerator()
delete r;
rRet = new RTPRandomRand48();
}
return rRet;
}