########################################################
# sub notify_time_date can be called with two arguments
# to be prepended and appended to a formatted display:
#
# '$arg11-Jan-99 at 01:10:49$arg2'.
#
# Arguments can be empty strings, or string of blanks
# for spacing, etc. These arguments are expected to
# be part of the call to the sub, so we'll first see
# if they're present by using 'shift':
#
########################################################
sub notify_time_date {
my ($msg1) = shift;
my ($msg2) = shift;
# Some local/my variables to hold the time info
my ($sec,$min,$hr,$mday,$mon,$yr,$timelet,$mon_name);
# And some literals in %mnames for conversion
# of that info into human-comfortable form
my %mnames = (1,"Jan",2,"Feb",3,"Mar",4,"Apr",5,"May",6,"Jun",
7,"Jul",8,"Aug",9,"Sep",10,"Oct",11,"Nov",12,"Dec");
# We ask the system for the local time
($sec,$min,$hr,$mday,$mon,$yr)=localtime(time);
# Now we see if any time digits need a leading zero
foreach $timelet ($sec,$min,$hr)
{
if ($timelet < 10) { $timelet = 0 . $timelet; }
}
# And get our human-comfortable month name
$mon_name = $mnames{$mon + 1}; # Perl counts from zero
# And finally notify the user at the console
# of the time we began the current mail polling
print "$msg1";
print "$mday-$mon_name-$yr at $hr:$min:$sec";
print "$msg2";
}