Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: Unique filenames with Time::HiRes

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

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

This is exactally what I need to do.

I will create files that look like XXX~gettimeofday()~PID.xml and sort on the time of day. If there are two files with the same time of day I will have to build in some kind of exception handeling for the sequence thing.

Thank you!

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
Re^3: Unique filenames with Time::HiRes
by mhi (Friar) on Jul 19, 2004 at 10:01 UTC
    Cycling through all the PIDs within a second (or whatever is the smallest increment of time you can get) is not the problem. Hitting that cycle in one of those itervals is. And it will happen.

    So what you need to do for your exception handling is to first determine how high the process counter on your machine can count (this may possibly change with OS updates, so I'd try to get that information dynamically from the OS). Then decide that if there is a difference of for examle at least half that maximum count between PIDs in your filenames, the lower block of them came after the higher block. Process them accordingly

    That should do ya.

    Update: grinder has /msged me that this will not work on BSD type boxes where random PID allocation (a security feature) has been configured. He's probably right, so you better talk to your admin before relying on consecutive PID allocation for the next couple of years. :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-09-23 07:40 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (210 votes), past polls