user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Varun Varada <varuncvarada@gmail.com>
To: meta@public-inbox.org
Subject: [Patch] Update 24-hour times to use two digits for the hour
Date: Fri, 5 Jun 2020 15:22:50 -0500	[thread overview]
Message-ID: <CAD2i4DDD8XCPQ2t61VJ-f4BSGkktcBf2O89K1ARGv=C1f+reqw@mail.gmail.com> (raw)

Hello,

Here is a patch to update the timestamps displayed to have 2 digits
for the hour when since it is using the 24-hour clock:

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0bc2b06e..def138c6 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -178,7 +178,7 @@ sub nr_to_s ($$$) {
 }

 # human-friendly format
-sub fmt_ts ($) { strftime('%Y-%m-%d %k:%M', gmtime($_[0])) }
+sub fmt_ts ($) { strftime('%Y-%m-%d %H:%M', gmtime($_[0])) }

 # Displays the text of of the message for /$INBOX/$MSGID/[Tt]/ endpoint
 # this is already inside a <pre>
diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm
index 3c933156..c3b29c49 100644
--- a/lib/PublicInbox/WwwStatic.pm
+++ b/lib/PublicInbox/WwwStatic.pm
@@ -294,12 +294,12 @@ sub dir_response ($$$) {
  } else {
  next;
  }
- # 54 = 80 - (SP length(strftime(%Y-%m-%d %k:%M)) SP human_size)
+ # 54 = 80 - (SP length(strftime(%Y-%m-%d %H:%M)) SP human_size)
  $hsize = sprintf('% 8s', $hsize);
  my $pad = 54 - length($name);
  $pad = 1 if $pad <= 0;
  $entry .= qq(<a\nhref="$href">$name</a>) . (' ' x $pad);
- $mtime = strftime('%Y-%m-%d %k:%M', gmtime($mtime));
+ $mtime = strftime('%Y-%m-%d %H:%M', gmtime($mtime));
  $entry .= $mtime . $hsize;
  }

diff --git a/xt/msgtime_cmp.t b/xt/msgtime_cmp.t
index 95d7c64b..6f4ca198 100644
--- a/xt/msgtime_cmp.t
+++ b/xt/msgtime_cmp.t
@@ -36,7 +36,7 @@ sub quiet_is_deeply ($$$$$) {
  ($old->[0] != $cur->[0]) ||
  ($old->[1] != $cur->[1]))) {
  for ($cur, $old) {
- $_->[2] = strftime('%Y-%m-%d %k:%M:%S', gmtime($_->[0]))
+ $_->[2] = strftime('%Y-%m-%d %H:%M:%S', gmtime($_->[0]))
  }
  is_deeply($cur, $old, "$func $oid");
  diag('got: ', explain($cur));


Regards,
Varun

             reply	other threads:[~2020-06-05 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 20:22 Varun Varada [this message]
2020-06-05 22:03 ` [Patch] Update 24-hour times to use two digits for the hour Eric Wong
2020-06-05 22:48   ` Varun Varada
2020-06-05 23:27     ` Eric Wong
2020-06-06  0:11       ` Varun Varada
2020-06-06  0:27         ` Eric Wong
2020-06-06 21:27     ` Dmitry Alexandrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD2i4DDD8XCPQ2t61VJ-f4BSGkktcBf2O89K1ARGv=C1f+reqw@mail.gmail.com' \
    --to=varuncvarada@gmail.com \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).