After I complete each task, I launch ‘iDid’ and enter a brief statement to describe the task. Make sure that you create your iDid.txt file prior to running the program. I must give credit to My-Kell for writing the time function and saving me some precious time. Here is the code:
#!/usr/bin/perl
use strict;
open(DID, ">>/path/to/iDid.txt");
my $time = &gettime();
sub gettime {
my @timearray = (my $_sec,my $_min,my $_hour,my $_mday,my $_mon,my $_year,my $_wday,my $_yday,my $_isdst) = localtime(time);
my $months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[(localtime)[4]];
my $currenthour = sprintf ("%0.2d",$_hour);
my $currentmin = sprintf ("%0.2d",$_min);
my $currentsec = sprintf ("%0.2d",$_sec);
my $currentyear = $_year+1900;
my $currentday = sprintf ("%0.2d",$timearray[3]);
my $currentmonth = sprintf ("%0.2d",$timearray[4] + 1);
my $today = "$currentyear-$currentmonth-$currentday";
my $currenttime = "$today $currenthour:$currentmin:$currentsec";
return $currenttime;
}
print "I did... ";
my $accomplishment = ;
print DID “$time — $accomplishment\n”;
close(DID);