sub _timestamp { my $t = shift; # allow me to pass in a time $t = time unless $t; # use the current time if none specified my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t); my $timestamp = sprintf("%04u-%02u-%02u %02u:%02u:%02u", $year + 1900, $mon + 1, $mday, $hour, $min, $sec); return $timestamp; }