Generate notification id in range of unsigned int

Signed-off-by: Max Risuhin <risuhin.max@gmail.com>
This commit is contained in:
Max Risuhin 2018-10-18 21:15:01 +03:00
parent 0cb528ff92
commit c25f57feb0
No known key found for this signature in database
GPG Key ID: BF733F5ACA0B4448
1 changed files with 4 additions and 1 deletions

View File

@ -34,7 +34,10 @@ uint m_idCount = 1;
}
uint getNewId() {
const QDateTime& d = QDateTime::currentDateTime();
QString result = QString(QStringLiteral("%1%2")).arg(d.toString(QStringLiteral("Hmmsszzz"))).arg(m_idCount++);
QString result = QString(QStringLiteral("%1%2")).arg(d.toString(QStringLiteral("Hmmss"))).arg(m_idCount++);
if (m_idCount >= 1000) {
m_idCount = 0;
}
return result.toUInt();
}