Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Using time or even time::Hires does not Using time or even time::Hires does not guarantee you uniqueness in any manner. How do you know your application will not be run more then once concurrently? BTW are you using human time or ctime? Don't forget about day light savings time, clock adjustments from ntp, server moves to a different timezone, etc.,etc.,etc. Clocks change. Are you sure? What about when you borrow your code and reuse it on a busier site and forget about that hidden feature?I would have to vote for the either the use of rand, or the use of Data::UUID (see link above). I never played with Data::UUID, but it looks like something to add to the list to check out. As cowdawg stated the probability of a collistion is low, and you need to VERIFY that the number is unique. BTW a name collistion is generally always possible no matter what you do. Heck, if you are convienced that you MUST use time(), or a varient, append a random number to the "time," My $1.50,- smellysocks In reply to Re: Re: Use time() to create unique ID
by smellysocks
|
|