about summary refs log tree commit homepage
path: root/lib/PublicInbox/Admin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Admin.pm')
-rw-r--r--lib/PublicInbox/Admin.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index cc9d2171..a1b1fc07 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -6,7 +6,7 @@
 package PublicInbox::Admin;
 use v5.12;
 use parent qw(Exporter);
-our @EXPORT_OK = qw(setup_signals);
+our @EXPORT_OK = qw(setup_signals fmt_localtime);
 use PublicInbox::Config;
 use PublicInbox::Inbox;
 use PublicInbox::Spawn qw(run_qx);
@@ -381,4 +381,12 @@ sub do_chdir ($) {
         }
 }
 
+sub fmt_localtime ($) {
+        require POSIX;
+        my @lt = localtime $_[0];
+        my (undef, $M, $H, $d, $m, $Y) = @lt;
+        sprintf('%u-%02u-%02u % 2u:%02u ', $Y + 1900, $m + 1, $d, $H, $M)
+                .POSIX::strftime('%z', @lt);
+}
+
 1;