469,602 Members | 1,715 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Sort Guid by CreationTimestamp

Hi

Does anybody has an idea how to have guids, created on many computers,
sorted by Timestamp? It doesn't have to be very accurate, but it would mean
a great optimization for my datastructures.

I made a small testroutine and I have a 50% chance that the new guid is
smaller than the guid created a second before on 1 computer.

Any idea is appreciated.
private void button1_Click(object sender, EventArgs e)

{

Console.WriteLine("Begin");

Guid Old = Guid.Empty;

int Big = 0;

int Small = 0;

for (int I = 0; I < 100; I++ )

{

Guid G = Guid.NewGuid();

int z = G.CompareTo(Old);

if (z < 0)

{

Small++;

Console.WriteLine("Guid is smaller");

}

else

{

Big++;

}

Old = G;

Thread.Sleep(1000);

}

Console.WriteLine("End {0} {1}", Small, Big);

}
Nov 16 '05 #1
0 1132

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Louis Frolio | last post: by
reply views Thread by Alexander Muylaert | last post: by
9 posts views Thread by Rene | last post: by
14 posts views Thread by Nak | last post: by
5 posts views Thread by George | last post: by
5 posts views Thread by Michael Primeaux | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.