Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Unique filenames with Time::HiRes

by AcidHawk (Vicar)
on Jul 19, 2004 at 14:38 UTC ( #375565=note: print w/ replies, xml ) Need Help??

in reply to Re: Unique filenames with Time::HiRes
in thread Unique filenames with Time::HiRes


I origionally started this way, however when the daemon starts again it restarted the counter, if any previous files still existed, say at num 1001, and I restarted the daemon again, I would start creating files at number 1. This causes the files to be processed in the incorrect order.

Of all the things I've lost in my life, its my mind I miss the most.

Comment on Re^2: Unique filenames with Time::HiRes
Replies are listed 'Best First'.
Re^3: Unique filenames with Time::HiRes
by waswas-fng (Curate) on Jul 19, 2004 at 16:34 UTC
    Why not do a gettimeofday(), test to see if the file name exists, if it does then loop for a few ms, then rinse and repeat until the gettimeofday is unique?

Re^3: Unique filenames with Time::HiRes
by mutated (Monk) on Jul 20, 2004 at 13:14 UTC
    It's relatively easy though when the daemon is starting for it to check and make sure it is starting above the last number that exists, it can take it's time because until it starts responding to requests for numbers the programs calling it should just block or whatever..


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-27 04:18 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (717 votes), past polls