You should use a key that will allow you to identify each row uniquely. If you insert multiple records into the database "at the same time", chances are some of them will be inserted within the same second. localtime's smallest unit of measurement is a second, so it probably is not going to garuantee uniqueness very well ...
$ perl -le"print localtime for 0..9" 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061 55161926610362061
Time::HiRes, however:
$ perl -MTime::HiRes=time -le"print time for 0..9" 1059265047.22228 1059265047.22246 1059265047.22248 1059265047.22251 1059265047.22253 1059265047.22255 1059265047.22257 1059265047.22259 1059265047.22261 1059265047.22264
may work very well for your needs. But, keep in mind that a simple integer works well if you remember to keep it incremented. This is one reason why i prefer a database management system instead. (but i wouldn't be surprised if a CPAN module exists that auto increments a key for you.)

UPDATE: i ran the second Perl one-liner again and redirected to a file. Here's the contents of that file:

1059265476.27685 1059265476.27695 1059265476.27696 1059265476.27696 1059265476.27697 1059265476.27697 1059265476.27698 1059265476.27698 1059265476.27699 1059265476.27699
Like i said, an auto incremented id makes uniqueness a lot easier to maintain.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: Using localtime() as a unique identifier by jeffa
in thread Using localtime() as a unique identifier by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.