mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 02:41:49 +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
|
||||
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;
|
||||
ss << std::setfill('0') << std::hex
|
||||
<< std::setw(4) << (std::rand() % 0xffff) << std::setw(4) << (std::rand() % 0xffff)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue