Dany has asked for the wisdom of the Perl Monks concerning the following question:
Hello:
I like use for a name of a file the next format:
- LVK"yyyymmddhhmmss(msmsmsms)".dat
Where (ms...) is for miliseconds, but i don't knock any function that return the milisecons for a localtime.
It is possible
Thanks
You can retrieve date and time information with high precision via the Time::HiRes module. The module documentation includes a number of examples of use.
The code which you end up using might look something like the following ...
use Time::HiRes qw/ time /;
my $u_sec = time;
my @date = localtime($u_sec);
my $format = sprintf(
"%4d%02d%02d%02d%02d%02d(%06d)",
$date[5] + 1900,
$date[4] + 1,
$date[3],
$date[2],
$date[1],
$date[0],
substr($u_sec, index($u_sec, '.') + 1)
);
print $format, "\n";