【活動記録】ネットでタイムスタンプ【試作】

・起床時間、睡眠時間、勤務時間(始業・就業)の管理、通勤通学時間の測定、などなど。

・よく会話のネタになる"ドアtoドアで何時間?"を測定できます。 この質問、答えられないこと結構ありませんか?

cgiのソース(perl)はこちらです。

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";

# Set time
($sec, $min, $hour, $day, $mon, $year, $wdy, $yday, $isdst)
= localtime(time);
@youbi = ("日","月","火","水","木","金","土");
$year += 1900; $mon++;

#
$str = sprintf("%04d/%02d/%02d %s %02d:%02d:%02d\n",
$year,$mon,$day,$youbi[$wdy],$hour,$min,$sec);
open(OUT,">log.tmp");
print OUT $str;
close OUT ;

open(IN, "log.dat");
open(OUT, ">>log.tmp");
while(){ print OUT;}
close IN;
close OUT;

open(IN, "log.tmp");
open(OUT, ">log.dat");
while(){
print OUT;
print $_."\n";
}
close IN;
close OUT;
カテゴリ: