Skip to content

Instantly share code, notes, and snippets.

@kiyotakagoto
Created November 23, 2011 10:14
Show Gist options
  • Save kiyotakagoto/1388337 to your computer and use it in GitHub Desktop.
Save kiyotakagoto/1388337 to your computer and use it in GitHub Desktop.
perlでミリ秒を求める
use Time::HiRes;
my $num = 0;
##### gettimeofday() は、1つ目の要素が整数秒、2つ目の要素が小数点以下の数値である配列を返す
my $start_time = join '.', Time::HiRes::gettimeofday;
while ( $num < 10000000 ) {
print $num++, "\n";
}
my $end_time = join '.', Time::HiRes::gettimeofday;
my $diff = $end_time - $start_time;
print "costs : ${diff}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment