Tuesday, March 20, 2007

perl 経過時間 秒

my $start_sec= time;# 終了時間の取得
my $end_sec = time;# 終了時間の取得
my $finish_time = $end_sec - $start_sec;
my $finish_minute = int($finish_time / 60);# 分の取得
my $finish_sec = $finish_time % 60;
print sprintf("%d分%d秒",$finish_minute,$finish_sec);

No comments: