From e3444977887f7615cef271341f29f3a87a36eac9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 13 Dec 2023 00:50:11 +0000 Subject: treewide: avoid strftime %k for portability The musl strftime(3) implementation on AlpineLinux 3.19.0 doesn't support `%k' and `%k' isn't in POSIX, either. So we fall back to using the `sprintf' perlop in the user-facing UI since leading zeroes require needless overhead for my eyes and brain to parse in the time. --- lib/PublicInbox/LeiXSearch.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/LeiXSearch.pm') diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index cee3ad07..fc95d401 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -298,8 +298,9 @@ sub fudge_qstr_time ($$$) { $rft = $diff; } $lr -= ($rft || (48 * 60 * 60)); + require PublicInbox::Admin; $lei->qerr("# $uri limiting to ". - strftime('%Y-%m-%d %k:%M %z', localtime($lr)). ' and newer'); + PublicInbox::Admin::fmt_localtime($lr).' and newer'); # this should really be rt: (received-time), but no stable # public-inbox releases support it, yet. my $dt = 'dt:'.strftime('%Y%m%d%H%M%S', gmtime($lr)).'..'; -- cgit v1.2.3-24-ge0c7