Found lurking in the codebase:
sub get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss { my $time_val = $_[0]; my $err_msg_ref = $_[1];Mommy!
my $date; my $day; my $fatal_msg; my $file; my $hasargs; my $hour; my $line; my $min; my $mon; my $msg; my $pack; my $ref; my $sec; my $subname; my $subroutine_name; my @time_attrs; my $time_str; my $want_array; my $year;
$want_array = wantarray;
$subroutine_name = 'get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss';
if (ref $err_msg_ref eq 'SCALAR') { $$err_msg_ref = undef; } else { $err_msg_ref = undef; }
if (! defined $want_array) { if ($err_msg_ref) { ($pack, $file, $line, $subname, $hasargs) = caller 1;
$msg = $pack.'::'.$subname.' ('.$line.') : The method '. (PACKAGE_NAME).'::'.$subroutine_name.' called in '. 'void context. It makes no sense to call this '. 'method in void context.';
$$err_msg_ref = $msg; }
return; }
if (! defined $time_val) { $time_val = time; }
eval { @time_attrs = localtime $time_val; };
$fatal_msg = $@;
if ($fatal_msg) { if ($err_msg_ref) { $$err_msg_ref = $fatal_msg; }
if ($want_array) { return (); } else { return undef; } } elsif (!@time_attrs) { if ($err_msg_ref) { ($pack, $file, $line, $subname, $hasargs) = caller 0;
$msg = $pack.'::'.$subname.' ('.$line.') : Call to localtime '. 'failed to retrieve the second, minute, hour, day, '. 'month, and year given the value '.$time_val.'.';
$$err_msg_ref = $msg;
if ($want_array) { return (); } else { return undef; } } }
$sec = $time_attrs[0]; $min = $time_attrs[1]; $hour = $time_attrs[2]; $day = $time_attrs[3]; $mon = $time_attrs[4]; $year = $time_attrs[5];
$mon++; $year += 1900;
foreach $ref (\$sec, \$min, \$hour, \$day, \$mon) { if (($$ref >= 0) && ($$ref < 10)) { $$ref = '0'.$$ref; } }
$date = $year.'-'.$mon.'-'.$day; $time_str = $hour.':'.$min.':'.$sec;
if ($want_array) { return ($date, $time_str); } else { return $date; } }