Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Unique filenames with Time::HiRes

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


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

Hi,

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?


    -Waswas
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..


    daN.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found