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

Unique stamp

by schwern (Scribe)
on Aug 13, 2005 at 02:19 UTC ( #483481=note: print w/ replies, xml ) Need Help??


in reply to Time in Milliseconds or NanoSeconds

So there is no temp file concept. I have to create unique names to use + in the same file.

Process ID + timestamp + a counter.

my $counter = 0; sub unique_stamp { return join '_', $$, time, $counter++; }

The PID makes it unique between processes. The time makes it unique in case of PID rollover. The counter makes it unique when the same process issues two stamps inside the granularity of the timer. It also makes the granularity of the time not so important.


Comment on Unique stamp
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-29 04:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls