There's more than one way to do things | |
PerlMonks |
Re: printing date on a fileby davido (Cardinal) |
on Sep 18, 2003 at 21:19 UTC ( [id://292522]=note: print w/replies, xml ) | Need Help?? |
If you don't require millisecond resolution, you can just do this:
But that only provides 'to the second' resolution. The nice thing is that it is preformatted in a well-recognized fashion. If you require millisecond resolution you may use the Time::HiRes module. Specifically, with the time() function of that module you can obtain the time of day in floating point seconds since epoch. You'll then have to run it through the localtime function, and insert back into the 'localtime' time stamp the decimal portion to convert the output of time() to a human understandable format. Time::HiRes relies on certain functions being available in your systems OS. If they're not there, it will fail. UPDATE: Here is an example using Time::HiRes
This snippet doesn't implement file locking. I presume that you've already got that part figured out. The snippet works as follows:
Dave "If I had my life to do over again, I'd be a plumber." -- Albert Einstein
In Section
Seekers of Perl Wisdom
|
|