Make tests pass on systems without %s strftime specifier
[app-lastmsg.git] / lib / App / Lastmsg.pm
index a5a27b59c42af9fea88cebcfee4c86d870469561..8d2cce57eb09d247c336dcd61711c9ed32a58d0d 100644 (file)
@@ -18,6 +18,8 @@ our @DEFAULT_INBOX;
 push @DEFAULT_INBOX, "/var/mail/$ENV{USER}" if exists $ENV{USER};
 push @DEFAULT_INBOX, "$ENV{HOME}/Maildir"   if exists $ENV{HOME};
 
+sub format_time { strftime '%c', localtime shift }
+
 sub run {
        my $config = Config::Auto->new(format => 'yaml')->parse;
        die "No configuration file found\n" unless $config;
@@ -94,7 +96,7 @@ sub run {
        my $addrlen = max map { length } values %lastaddr;
 
        for (sort { $lastmsg{$b} <=> $lastmsg{$a} } keys %lastmsg) {
-               my $time = strftime '%c', localtime $lastmsg{$_};
+               my $time = format_time $lastmsg{$_};
                printf $OUTPUT_FILEHANDLE "%-${idlen}s %-${addrlen}s %s\n", $_, $lastaddr{$_}, $time;
        }
 
This page took 0.009435 seconds and 4 git commands to generate.