mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-03 19:31:43 +02:00
fix generateUUID
This commit is contained in:
parent
f17797b43d
commit
4206ccb3c3
1 changed files with 6 additions and 1 deletions
|
@ -269,7 +269,12 @@ static long uptime()
|
||||||
/// http://stackoverflow.com/questions/2174768/generating-random-uuids-in-linux
|
/// http://stackoverflow.com/questions/2174768/generating-random-uuids-in-linux
|
||||||
static std::string generateUUID()
|
static std::string generateUUID()
|
||||||
{
|
{
|
||||||
std::srand(std::time(0));
|
static bool initialized(false);
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
|
std::srand(std::time(0));
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << std::setfill('0') << std::hex
|
ss << std::setfill('0') << std::hex
|
||||||
<< std::setw(4) << (std::rand() % 0xffff) << std::setw(4) << (std::rand() % 0xffff)
|
<< std::setw(4) << (std::rand() % 0xffff) << std::setw(4) << (std::rand() % 0xffff)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue