user/dev discussion of public-inbox itself
 help / Atom feed
* [PATCH 0/3] misc minor fixups
@ 2016-12-13  3:48 Eric Wong
  2016-12-13  3:48 ` [PATCH 2/3] nntp: avoid useless use of strftime Eric Wong
  2016-12-13  3:48 ` [PATCH 3/3] searchmsg: remove unused EPOCH_822 constant Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-13  3:48 UTC (permalink / raw)
  To: meta

Nothing major, just some cleanups I noticed while working on
other stuff...

Eric Wong (3):
      nntp: add test case for the "DATE" command
      nntp: avoid useless use of strftime
      searchmsg: remove unused EPOCH_822 constant

 lib/PublicInbox/NNTP.pm      | 4 ++--
 lib/PublicInbox/SearchMsg.pm | 1 -
 t/nntpd.t                    | 8 ++++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|threaded] 3+ messages in thread

* [PATCH 2/3] nntp: avoid useless use of strftime
  2016-12-13  3:48 [PATCH 0/3] misc minor fixups Eric Wong
@ 2016-12-13  3:48 ` Eric Wong
  2016-12-13  3:48 ` [PATCH 3/3] searchmsg: remove unused EPOCH_822 constant Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-13  3:48 UTC (permalink / raw)
  To: meta

There's no need to use strftime if we'll be converting the date
by hand, anyways.
---
 lib/PublicInbox/NNTP.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index b7143ff..9408ffb 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -250,8 +250,8 @@ sub parse_time ($$;$) {
 		($YYYY, $MM, $DD) = unpack('A4A2A2', $date);
 	} else { # legacy clients send YYMMDD
 		($YYYY, $MM, $DD) = unpack('A2A2A2', $date);
-		if ($YYYY > strftime('%y', @now)) {
-			my $cur_year = $now[5] + 1900;
+		my $cur_year = $now[5] + 1900;
+		if ($YYYY > $cur_year) {
 			$YYYY += int($cur_year / 1000) * 1000 - 100;
 		}
 	}
-- 
EW


^ permalink raw reply	[flat|threaded] 3+ messages in thread

* [PATCH 3/3] searchmsg: remove unused EPOCH_822 constant
  2016-12-13  3:48 [PATCH 0/3] misc minor fixups Eric Wong
  2016-12-13  3:48 ` [PATCH 2/3] nntp: avoid useless use of strftime Eric Wong
@ 2016-12-13  3:48 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-12-13  3:48 UTC (permalink / raw)
  To: meta

This hasn't been needed since our Email::Abstract removal
for message threading.
---
 lib/PublicInbox/SearchMsg.pm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index 9dcc1e6..5779d1e 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -12,7 +12,6 @@ use Date::Parse qw/str2time/;
 use PublicInbox::MID qw/mid_clean/;
 use PublicInbox::Address;
 our $PFX2TERM_RE = undef;
-use constant EPOCH_822 => 'Thu, 01 Jan 1970 00:00:00 +0000';
 use POSIX qw(strftime);
 
 sub new {
-- 
EW


^ permalink raw reply	[flat|threaded] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13  3:48 [PATCH 0/3] misc minor fixups Eric Wong
2016-12-13  3:48 ` [PATCH 2/3] nntp: avoid useless use of strftime Eric Wong
2016-12-13  3:48 ` [PATCH 3/3] searchmsg: remove unused EPOCH_822 constant Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox