Re: Generating Unique ID
Re: Generating Unique ID
- Subject: Re: Generating Unique ID
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 05 Sep 2003 06:14:09 -0400
on 03-09-05 1:40 AM, Georg Tuparev at email@hidden wrote:
>
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
Judging from the documentation, this does not fill the bill.
UUIDs, which are governed by a formal specification available on the Web,
are persistent, and they are guaranteed to be unique across all machines
using the same algorithm to generate UUIDs, and for more than a thousand
years into the future. The algorithm involves using the machine's hardware
MAC address (which is unique by virtue of the international process for
assigning MAC addresses to hardware), the date, and some other factors,
including an algorithm (which I have not attempted to understand) for
dealing with clocks that are out of sync.
A -globallyUniqueString is apparently transient, guaranteed to be unique
only for a given process on a given network during a given session, although
the documentation isn't mathematically precise about the algorithm: "This
method uses the host name, process ID, and a time stamp to ensure that the
string returned will be unique for the network. This method generates a new
string each time it is invoked, so it also uses a counter to guarantee that
strings created from the same process are unique." It apparently would not
serve to generate unique record ids for a database that will be used
repeatedly over time on different machines.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.