title: Qt - Create a time-based UUID
body: <p>I want to create v1 UUID (time-based) in Qt</p>
  
  <p>I tried using <a href="https://github.com/sean-/ossp-uuid" rel="nofollow">cppuuid</a> but couldn't get correct uuid
  I also tried <a href="http://www.ossp.org/pkg/lib/uuid/" rel="nofollow">ossp uuid</a> but got error while building, and I prefer to avoid using it anyway</p>
  
  <p><strong><em>I need the most simple and short way to generate such uuid in Qt (I prefer a Qt class, if any)</em></strong></p>
  
  <p>I want v1 uuid's to use it as a primary key in my database </p>
  
  <p>see <a href="http:////https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/" rel="nofollow">//https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/
  </a> </p>
  
  <p><strong>I tried cppuuid as follows</strong></p>
  
  <pre><code>    qulonglong v1 = 0x19432987;
      qulonglong v2= 0x33;
  
      uuid::Uuid u = uuid::uuid1( v1,v2 );
  
      QByteArray uuid = QByteArray().append( QString::fromStdString( u.hex()));
  
      qDebug() &lt;&lt; "uuid size" &lt;&lt; uuid.size(); // 25
      qDebug() &lt;&lt; "uuid" &lt;&lt; uuid;
      qDebug() &lt;&lt; "uuid hex" &lt;&lt; uuid.toHex();
      qDebug() &lt;&lt; "uuid hex size" &lt;&lt; uuid.toHex().size(); //50
  </code></pre>
  
  <p><strong>Edit</strong>: I have found why cppuuid was giving wrong results, details are in my answer</p>