23 #include <QCoreApplication> 25 #include <QCryptographicHash> 27 #if (defined _WIN32_) || (defined _MSC_VER) 37 QDateTime currentDateTime = QDateTime::currentDateTime();
38 uint64_t uid = currentDateTime.toTime_t();
52 uint32_t uid = (QCoreApplication::applicationPid() % (1<<16));
54 QString hostname = QHostInfo::localHostName();
55 QByteArray hashKey = QCryptographicHash::hash(hostname.toUtf8(), QCryptographicHash::Sha1);
58 for (
int i = 0;
i < hashKey.size();
i++) {
59 char c = hashKey.at(
i);
64 uid += (hashHost<<16);
71 #if (defined _WIN32_) || (defined _MSC_VER) 72 LARGE_INTEGER tickPerSecond;
76 QueryPerformanceFrequency(&tickPerSecond);
79 QueryPerformanceCounter(&tick);
82 return (tick.QuadPart % tickPerSecond.QuadPart);
static uint64_t getCurrentMiroseconds()
static uint64_t getNewObjectId()
static uint32_t getNewInstanceId()
unsigned __int64 uint64_t