diff options
author | Eric Wong <e@yhbt.net> | 2020-01-05 23:23:32 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-06 10:20:45 +0000 |
commit | b503e583ede0b35a30aa3f14096c0605e3032439 (patch) | |
tree | 55d5f8c2bf6a82709d4e8be0ac5ae8a566447cb0 /lib/PublicInbox | |
parent | 11eec3365d537b20ade6923eaa5fdd18206d4342 (diff) | |
download | public-inbox-b503e583ede0b35a30aa3f14096c0605e3032439.tar.gz |
The POSIX module is always loaded, so import `strftime' into the namespace so we can use it and take advantage of compile-time arg checking. While we're at it, update and reorder caller functions to use prototypes, too.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/View.pm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 5acd565a..405da2a9 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -16,7 +16,7 @@ use PublicInbox::Address; use PublicInbox::WwwStream; use PublicInbox::Reply; use PublicInbox::ViewDiff qw(flush_diff); -require POSIX; +use POSIX qw(strftime); use Time::Local qw(timegm); use PublicInbox::SearchMsg qw(subject_normalized); use constant COLS => 72; @@ -208,6 +208,9 @@ sub nr_to_s ($$$) { $nr == 1 ? "$nr $singular" : "$nr $plural"; } +# human-friendly format +sub fmt_ts ($) { strftime('%Y-%m-%d %k:%M', gmtime($_[0])) } + # this is already inside a <pre> sub index_entry { my ($smsg, $ctx, $more) = @_; @@ -926,8 +929,6 @@ sub missing_thread { PublicInbox::ExtMsg::ext_msg($ctx); } -sub fmt_ts { POSIX::strftime('%Y-%m-%d %k:%M', gmtime($_[0])) } - sub dedupe_subject { my ($prev_subj, $subj, $val) = @_; @@ -1159,10 +1160,8 @@ sub dump_topics { 200; } -sub ts2str ($) { - my ($ts) = @_; - POSIX::strftime('%Y%m%d%H%M%S', gmtime($ts)); -} +# only for the t= query parameter passed to overview DB +sub ts2str ($) { strftime('%Y%m%d%H%M%S', gmtime($_[0])) }; sub str2ts ($) { my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $_[0]); |