Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Use time() to create unique ID

by sulfericacid (Deacon)
on Sep 16, 2003 at 15:34 UTC ( [id://291850]=note: print w/replies, xml ) Need Help??


in reply to Use time() to create unique ID

Like the other two have said, you could always use use Time::HiRes 'time';, instead of having to sleep. I recently ran into this same problem with a CGI file uploader (used the localtime() as a unique key and allowed 4 uploads at a time; which without saying, most of the time the files used the same key and overwrote the others). sleep may not be the best choice but I don't see anything other than time as a setback. Just keep in mind you're sleeping after each loop and a sleep 5; will surely take forever if you have a 10,000 item array!

It's a safe method to ensure unique ID's, I still use this over use Time::HiRes 'time';.

Good luck.

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://291850]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found