Skip to content

Instantly share code, notes, and snippets.

@easternnl
Created October 18, 2019 06:25
Show Gist options
  • Select an option

  • Save easternnl/e14289ddeca1ee18fc40fe2f0d0fba78 to your computer and use it in GitHub Desktop.

Select an option

Save easternnl/e14289ddeca1ee18fc40fe2f0d0fba78 to your computer and use it in GitHub Desktop.
Working with milliseconds if the perl library does not support it https://stackoverflow.com/a/18101550
use Time::HiRes qw(time);
use POSIX qw(strftime);
my $t = time;
my $date = strftime "%Y%m%d %H:%M:%S", localtime $t;
$date .= sprintf ".%03d", ($t-int($t))*1000; # without rounding
print $date, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment