Hi,
Some time ago I found a certain code sample for VFP that would generate unique keys based on (among other things) value returned by system timer. I tried to modify it for usage in FP 2.6 and was quite happy with it... until a couple of weeks later I found that generated keys aren't that unique as I thought (fortunately it happened *before* I reported that the program is ready
). Looking for any possible bugs in places I won't bother you with, I finally got down to the core of things and wrote the following test program:
create cursor dummy ( num n(4), tim n(8) )
for i=1 to 9999
insert into dummy values ( i, seconds()*1000 )
next
Supposedly the order of two fields had to be identical (or at least have identical "tim" in adjacent "num" records, but nothing worse). In fact, after indexing the cursor I got something like this:
Num ?Tim
?????????????
10?56599569 <==
11?56599571 <==
1?56599601
2?56599604
3?56599607
4?56599609
5?56599612
6?56599614
7?56599617
8?56599619
9?56599621
14?56599625 <==
12?56599654
13?56599656
15?56599693
16?56599718
17?56599744
18?56599769
19?56599771
22?56599790 <==
20?56599795
...
What could be a reason for it? I'm running FP 2.6 on Windows XP SP2, if it matters.
Thanks.
Some time ago I found a certain code sample for VFP that would generate unique keys based on (among other things) value returned by system timer. I tried to modify it for usage in FP 2.6 and was quite happy with it... until a couple of weeks later I found that generated keys aren't that unique as I thought (fortunately it happened *before* I reported that the program is ready
create cursor dummy ( num n(4), tim n(8) )
for i=1 to 9999
insert into dummy values ( i, seconds()*1000 )
next
Supposedly the order of two fields had to be identical (or at least have identical "tim" in adjacent "num" records, but nothing worse). In fact, after indexing the cursor I got something like this:
Num ?Tim
?????????????
10?56599569 <==
11?56599571 <==
1?56599601
2?56599604
3?56599607
4?56599609
5?56599612
6?56599614
7?56599617
8?56599619
9?56599621
14?56599625 <==
12?56599654
13?56599656
15?56599693
16?56599718
17?56599744
18?56599769
19?56599771
22?56599790 <==
20?56599795
...
What could be a reason for it? I'm running FP 2.6 on Windows XP SP2, if it matters.
Thanks.