Connecting Tech Pros Worldwide Forums | Help | Site Map

Sort Guid by CreationTimestamp

Alexander Muylaert
Guest
 
Posts: n/a
#1: Nov 16 '05
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);

}



Closed Thread


Similar C# / C Sharp bytes