Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Shorter than sys(2015)
Message
De
06/02/2015 05:30:50
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
06/02/2015 04:28:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01614860
Message ID:
01614958
Vues:
51
>>>>>Do you know the exact formula?
>>>>
>>>>Not the exact formula, as it provides repeated results if called within the same millisecond (that is what I read in the thread, I have never tried this function myself) (my guess this is the old formula as sys(2015) was improved for VFP 9 or VFP 9 SP2, IIRC), but this guy wrote a similar one that apparently works:
>>>>
>>>>http://www.mrexcel.com/forum/excel-questions/77351-using-vfps-sys-2015-excel.html
>>>
>>>No, SYS(2015) does NOT give repeated results within the same millisecond. I've run tests of 100,000 iterations and SYS(2015) was unique. It always has been. SYS(3), OTOH, does repeat within the same millisecond.
>>>
>>>Tamar
>>
>>So we should correct the help file. :)
>
>Hi,
>no need for correction, just load the newest file (1.07) created and posted on VFPX :)
>
>quote
>Calling SYS(2015) more than once during the same millisecond interval returns a unique character string.
>unquote
>
>Regards,
>Koen

Hi Koen,

yes, that should do it. :)

I've tested like
FOR ln1 = 1 TO 10
 ?SYS(2015),seconds()
ENDFOR &&ln1 


I see two hits per milisecond, with increasing sys(2015)
Since there are two per milisecond there must be two within the same millisecond, even considering rounding. (I'm not sure if there is something that counts smaller then a millisecond, so the result shown could be rounded)

Now the only problem remaining is that this valid ony on a single thread :) Multiple threads still can create the same return value.

Simple program
create table
CREATE TABLE murks (c1 c(10))
use
and a prog snippet
USE murks SHARED again
FOR ln1 = 1 TO 100000
 INSERT INTO murks VALUES SYS(2015)
ENDFOR &&ln1 
Simultaneously run this snippet on two instances of VFP on the same comp.
This gives 200000 records

now test
SELECT COUNT(*) as ncnt, c1 FROM murks GROUP BY 2 HAVING ncnt>1
I come up with 32787 hits ... 16%
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform