about summary refs log tree commit homepage
path: root/lib/PublicInbox/Hval.pm
diff options
authorEric Wong <e@yhbt.net>2020-08-27 22:04:59 +0000
committerEric Wong <e@yhbt.net>2020-08-28 04:25:15 +0000
commit6c853f5256f3a324c018a37a9e8a6b9fc8fdc063 (patch)
treee8cbeb6cecde0e25ea4bc16d6ea53f19a42671c7 /lib/PublicInbox/Hval.pm
parent29c5f2a6fc3b86306a5dbeadfae061d06f2bc6dd (diff)
Sometimes it's useful to quickly get to threads and messages
which are contemporaries of the current thread/message being
focused on.  This hopefully improves navigation by making:

a) the top line (where $INBOX_DIR/description) is shown
   a link to the latest topics in search results and
   per-thread/per-message views.

b) providing a link to contemporaries ("~YYYY-MM-DD") at
   around the thread overview skeleton area for per-thread
   and per-message views
Diffstat (limited to 'lib/PublicInbox/Hval.pm')
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index e21a64a6..fb21041a 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -10,7 +10,8 @@ use Encode qw(find_encoding);
 use PublicInbox::MID qw/mid_clean mid_escape/;
 use base qw/Exporter/;
 our @EXPORT_OK = qw/ascii_html obfuscate_addrs to_filename src_escape
-                to_attr prurl mid_href/;
+                to_attr prurl mid_href fmt_ts ts2str/;
+use POSIX qw(strftime);
 my $enc_ascii = find_encoding('us-ascii');
 # safe-ish acceptable filename pattern for portability
@@ -123,4 +124,10 @@ sub to_attr ($) {
         $first . $str;
+# for the t= query parameter passed to overview DB
+sub ts2str ($) { strftime('%Y%m%d%H%M%S', gmtime($_[0])) };
+# human-friendly format
+sub fmt_ts ($) { strftime('%Y-%m-%d %k:%M', gmtime($_[0])) }