トップ 一覧 Farm 検索 ヘルプ RSS ログイン

Diary/2009-8-19の変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!経過秒を表現するとき
安易に考えて
 sub min2 {
 	my($p0) = @_;
 	my($p8,$p9);
 	
 	if ($p0 > 31557600) {
 		$p9 = int($p0 / 3155760) / 10 ; $p8 = "Year";
 	} elsif ($p0 > 2592000) {
 		$p9 = int($p0 / 259200) / 10 ; $p8 = "Month";
 	} elsif ($p0 > 684800) {
 		$p9 = int($p0 / 68480) / 10 ; $p8 = "weak";
 	} elsif ($p0 > 86400) {
 		$p9 = int($p0 / 8640) / 10 ; $p8 = "Day";
 	} elsif ($p0 > 3600) {
 		$p9 = int($p0 / 360) / 10 ; $p8 = "h";
 	} elsif ($p0 > 60) {
 		$p9 = int($p0 / 6) / 10 ; $p8 = "m";
 	} else {
 		$p9 = $p0 ; $p8 = "s";
 	}
 	return "$p9"."$p8";
 }
としてみた