Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl-Sensitive Sunglasses
 
PerlMonks  

Use a timestamp as filename?

by hackmare (Pilgrim)
on Jun 09, 2001 at 20:38 UTC ( [id://87230]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to sequencial file naming

Just a suggestion here... if you do not need the file names sequence to be gap-free, but nearly want them to be sequential, I suggest you use the epoch date (number of seconds since some time in the long, long past.

Next, you check that the file does not exist, and use that ID. If it exists, increment by one, and check again.

The upside is that unless you average 1 request per second, you're safe.

The downside is that the filenames are ugly.

On the command line, trz it with this: perl -e 'print "time()\n"

Hackmare

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://87230]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.