Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The Mother of Unique IDs
Message
From
19/10/1996 04:25:44
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00009899
Message ID:
00010537
Views:
49
>OK, have my Kevlar on. I decided to create a solid unique ID number generator. The only restriction I used was to stay within the 10 character default field length. The value I came up with, I figure, has an odds of 1 in 2.59 billion chance of being reproduced (duplicated) in Windows & 1 in 259 million chance in NT.
>
>Check it out:
>
>int(seconds() *100000 + day(date()))
>
>The resolution of seconds on an NT machine is 10 thousandths. In 95 an older, 1 thousandths. On a 133 Pentium I held down the CTRL+Y key and added records. Even in the NT setup no 2 records were ever near identical. It ain't perfect but it is getting close.
>
>Tom


Hi Tom,

Sorry I thnik I pressed 'default' on the last message. Here it is again just in case.

You can generate unique ID's using a built in function of VFP. It is meant to generate unique procedure names but I use it for unique ID's. It works on the same principle as your code but will be faster. Here is the wording from the VFP help file :

The name that SYS(2015) returns is created from the system date and system time. Calling SYS(2015) more than once during the same millisecond interval will return a unique character string.

Later, Jos
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform