Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another unique file name ?
Message
De
25/04/2001 10:33:56
 
 
À
25/04/2001 10:19:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00499538
Message ID:
00499580
Vues:
18
>>Oops!!
>>
>>The format was wrong !
>>
>>date = 6 ddmmyy
>>time = 6 hhmmss
>>millisec = 2 msms ?
>
>To get time and ms, CHRTRAN(TIME(1), ":.", "")
>
>FWIW: I've used DTOS(DATE())+CHRTRAN(TIME(1), ":.", "")
>This gives you yyyymmddhhmmssmsms which sorts better meets more Y2K compliant date configuration. It also makes sorting cleaner by year (if need that sort of thing). e.g., at the time of writing this: 2001042510112630
>
>In a very fast loop this presents the same problem as SYS(3), namely duplicate values, but I don't create files that fast :)
>HTH

My oops!
TIME(1) gives 100ths of seconds, not milliseconds.
But 100ths is what you wanted, right? Seeing as milliseconds would take 3 characters and not 2 < gd&r >

Also, for grins, I did a little fast file creation loop
* Create 100 unique files
For ji = 1 To 100
     lcFile=DToS(Date())+Chrtran(Time(1),":.","")+".txt"
     * check for unique file
     Do While File(lcFile)
          lcFile=DToS(Date())+Chrtran(Time(1),":.","")+".txt"
     EndDo
     lcFileVal = "This is file " + lcFile
     StrToFile(lcFileVal, lcFile)
EndFor
I ran this loop a couple dozen times and it took an average of 1.5 seconds.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform